Can anyone please help me on this Visual Studio 2008 code

Discussion in 'Programming' started by theemerchant, Jul 6, 2010.

  1. #1
    Hi,

    Can anyone please help me on this?

    The server is supposed to see which computers are online and which are not.
    if the workstation are not online the computer should not be seen on the server's list but if it open again the computer name should appear on the list.

    I used codes like this:

    on the
    shutdown button
    TvComputers.Nodes.
    Remove(tvcomputers.Selectednode)


    the problem is, when i open again the computer that is being shutdown on the workstation, it is not appearing on the server's list. what's wrong with the code and what should I do?

    Thanks a lot in advance.
     
    theemerchant, Jul 6, 2010 IP
  2. QuackWare

    QuackWare Member

    Messages:
    245
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    35
    #2
    Providing the full source of the application or at least more of the source then a few lines would help greatly since it is almost impossible to tell what you are doing from a single line.
     
    QuackWare, Jul 6, 2010 IP
  3. theemerchant

    theemerchant Guest

    Messages:
    185
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi,

    I am sorry i forgot to put the code source, this is the source code I put on the shutdown button

    Private Sub btnShutdown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShutdown.Click
    On Error Resume Next
    If MessageBox.Show("Are you sure you wish to shutdown " & Computer & "?", "Confirm shutdown", _
    MessageBoxButtons.YesNo, MessageBoxIcon.Question) = System.Windows.Forms.DialogResult.Yes Then
    strOperation = "SHUTDOWN"
    compIPaddress = ""
    compIPaddress = System.Net.Dns.GetHostByName(Computer).AddressList(0).ToString()
    If Trim(compIPaddress) = "" Then
    MsgBox("Please select a computer!!!", MsgBoxStyle.Information, "Computer???")
    Else
    trSendMessage = New Thread(AddressOf SendMessage)
    trSendMessage.Start()
    MessageBox.Show("Client " & Computer & " has been shutdown.")
    TVComputers.Nodes.Remove(TVComputers.SelectedNode)
    End If
    End If
    End Sub

    The List of server must see the workstation that is online and when computer is open again, the computer should see on the list.

    Thanks in advance,
     
    theemerchant, Jul 6, 2010 IP
  4. kohliamit03

    kohliamit03 Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You have taken an action for shutting down the remote computer but no action has been taken when that client will be up. So, you have two options you can move forward:
    1) make the client to tell server that the I am up add me or
    2) make the server to regularly check for all the connected clients when they wake up

    option1 is better because it won't give your an overhead to check for every client..

    The choice is always yours. both the options are for doing the work now it's upto your working enviornment which suits you more..

    Hope, this will resolve your problem..
     
    kohliamit03, Jul 6, 2010 IP
  5. theemerchant

    theemerchant Guest

    Messages:
    185
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    yeah, that is why I am asking what code I done wrong.. that is also why I am asking for the lack code is because I also tried everything. =( btw, thanks for your response... can anyone please help me fix the code?

    Thanks again in advance
     
    theemerchant, Jul 6, 2010 IP
  6. kohliamit03

    kohliamit03 Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    But the code you have written is for shutting down the remote computer.
    So, in the same way you write code on the client machines that as soon as they wake up should update the server list. If you have already done some thing like this paste your code so that we can ammend it.

    Waise there is one more thing you should according to me do. You should maintain a file on the server to which all clients can enter there IP's whenever they wake up and server can remove the IP of the client when they are shut down. Also the list should be populated by that only and for that you need to check you file regularly after a small interval of time.
     
    kohliamit03, Jul 7, 2010 IP
  7. theemerchant

    theemerchant Guest

    Messages:
    185
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7

    Hi,

    Is this what you are looking for?
    this code is from the form viewer of the derver which will show up the list of the workstations

    Private Sub TVComputers_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TVComputers.AfterSelect
    Computer = TVComputers.SelectedNode.Text
    End Sub

    Thanks again in advance
     
    theemerchant, Jul 8, 2010 IP
  8. kohliamit03

    kohliamit03 Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Yes this is the list but who is going to populate this and when will it be populated? I mean is there a way you define where you can find which client is up or which is down?

    I am saying that you need to install an application to the client machine which client machine is up will give a notification to the server that i am up add me...
     
    kohliamit03, Jul 8, 2010 IP