Results 1 to 15 of 15

Thread: Searching for server among my LAN

  1. #1

    Thread Starter
    Lively Member Dominator's Avatar
    Join Date
    Oct 2004
    Location
    Egypt
    Posts
    65

    Question Searching for server among my LAN

    Hi,

    I built a network application that do desktop monitoring and many other actions, I'm trying to improve the connection possibility, how the client will find the server, i know that LAN IP address is static in 1st 3 parts 192.168.1.NNN where is NNN is a dynamic part from0 to 255.

    I'm trying to build my client to find the server without providing the server IP.
    so when client start for the first time it will search for server on port 540 and IP address will be placed in for loop

    so the connect method will placed in for loop

    for(byte x=0; x<=255; x++)
    {
    connect(540,"192.168.1." + x);
    }

    by using this method i will try to connect to my server if server is online its supposed that client find server.

    is this a successful method, i need your opinion on this, is there a faster method, the connect method in c# take a while before telling me that connection refused, so searching from 0 to 255 will take time!!!

    please help me in this.

    Thanks in advanced for your help.
    .........................................................
    John F. Gouda {A.K.A}{Dominator Legend}
    Software Engineer
    +20-0125113313
    .......................................................
    Please feel free to download my projects:
    Http://DominatorLegend.Co.Nr
    .................................................................................................... ................................................................................................
    Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Searching for server among my LAN

    i know that LAN IP address is static in 1st 3 parts 192.168.1.NNN where is NNN is a dynamic part from0 to 255.
    Only in a class C network
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3

    Thread Starter
    Lively Member Dominator's Avatar
    Join Date
    Oct 2004
    Location
    Egypt
    Posts
    65

    Re: Searching for server among my LAN

    what u mean?
    .........................................................
    John F. Gouda {A.K.A}{Dominator Legend}
    Software Engineer
    +20-0125113313
    .......................................................
    Please feel free to download my projects:
    Http://DominatorLegend.Co.Nr
    .................................................................................................... ................................................................................................
    Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...

  4. #4
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Searching for server among my LAN

    look at what wikipedia has to say about this
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  5. #5

    Thread Starter
    Lively Member Dominator's Avatar
    Join Date
    Oct 2004
    Location
    Egypt
    Posts
    65

    Re: Searching for server among my LAN

    i don't figure it out,

    my LAN contain 30 computers the fixed part of their ip is 192.168.1 the dynamic part start from 1 to 30

    my server placed in any computer, i need to find it. so i will have to connect from 1 to 30 the one that accept the connection on specific port it will be the pc that contain my server.

    that what i mean, like a port scanner. but a fixed port.
    .........................................................
    John F. Gouda {A.K.A}{Dominator Legend}
    Software Engineer
    +20-0125113313
    .......................................................
    Please feel free to download my projects:
    Http://DominatorLegend.Co.Nr
    .................................................................................................... ................................................................................................
    Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...

  6. #6
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Searching for server among my LAN

    I thought you wanted something global, not just for your network.
    Anyway it seems that in Windows XP their is a tool called PathPing
    I think it might be helpful if there was a .NET class or library that can do what it does.
    If you try using it, the "Hop" number 1 is your local server
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  7. #7

    Thread Starter
    Lively Member Dominator's Avatar
    Join Date
    Oct 2004
    Location
    Egypt
    Posts
    65

    Re: Searching for server among my LAN

    thanks,

    but pathping and ping, just take as a param the ip
    i need to know if my app running there or not so i need a port too
    so ping 192.168.1.2 on port 198
    if result returned then server is running. server mean that my app is running in that machine.
    .........................................................
    John F. Gouda {A.K.A}{Dominator Legend}
    Software Engineer
    +20-0125113313
    .......................................................
    Please feel free to download my projects:
    Http://DominatorLegend.Co.Nr
    .................................................................................................... ................................................................................................
    Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...

  8. #8

    Thread Starter
    Lively Member Dominator's Avatar
    Join Date
    Oct 2004
    Location
    Egypt
    Posts
    65

    Re: Searching for server among my LAN

    I do the following code in VB6.
    Its work for the 1st time but if i repeat the code again it dosn't work. untill i restart both the server and the detector.

    Code:
    Private Sub Command1_Click()
        List.Clear
        Reload
        Command1.Enabled = False
        Dim SocketsCount As Integer
        For SocketsCount = Mid(T1, InStrRev(T1, ".") + 1, Len(T1.Text)) To Mid(T2, InStrRev(T2, ".") + 1, Len(T2.Text))
            Load Winsock(SocketsCount)
            L1.Caption = "Loading and Connecting Socket [ " & SocketsCount & " : " & Mid(T2, InStrRev(T2, ".") + 1, Len(T2.Text)) & " ]"
            Dim IP As String: IP = Mid(T1, 1, InStrRev(T1, ".")) & SocketsCount
            Winsock(SocketsCount).Protocol = sckTCPProtocol
            Winsock(SocketsCount).Close
            Winsock(SocketsCount).Connect IP, Val(T3.Text)
            Winsock(SocketsCount).Tag = IP
            DoEvents
        Next SocketsCount
        Command1.Enabled = True
    End Sub
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    ExitProcess (0)
    End Sub
    Private Sub Winsock_Connect(Index As Integer)
        List.AddItem "- " & Winsock(Index).RemoteHost & " Connected."
        Winsock(Index).SendData "PING"
        DoEvents
        Winsock(Index).Close
    End Sub
    Sub Reload()
        Dim X As Integer
        For X = 1 To Winsock.UBound
            Winsock(X).Close
            Unload Winsock(X)
        Next X
    End Sub
    sorry i wrote the code in VB6 cause it faster to code it than c#
    .........................................................
    John F. Gouda {A.K.A}{Dominator Legend}
    Software Engineer
    +20-0125113313
    .......................................................
    Please feel free to download my projects:
    Http://DominatorLegend.Co.Nr
    .................................................................................................... ................................................................................................
    Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...

  9. #9
    Hyperactive Member
    Join Date
    Oct 2006
    Posts
    354

    Re: Searching for server among my LAN

    Do you have active directory setup? Why not just make a group policy that forces that program to run all the time, and don't give user rights to turn it off?

    After that, set you monitoring program on your client to send SNMP messages every so often and have triggers set to do stuff based on the traps. This changes the scheme to passive monitoring, so you don't have to scan your network. You can even write your client app to send a message if it closes.

  10. #10

    Thread Starter
    Lively Member Dominator's Avatar
    Join Date
    Oct 2004
    Location
    Egypt
    Posts
    65

    Re: Searching for server among my LAN

    thanks a lot for ur advice
    but is there a chance to implement my idea, as searching LAN for a server is needed, many LAN applications don't need to setup the client to know server address it discover it automaticaly, by searching for a listeaners.

    the code i past is working but, if i click the Command1 twice, it show the result at first time, but if i change port and search, nothing found!!! its supposed that sockets object unloaded, so it should connect to new server using new ports!!.

    any idea!!

    Thanks alot
    .........................................................
    John F. Gouda {A.K.A}{Dominator Legend}
    Software Engineer
    +20-0125113313
    .......................................................
    Please feel free to download my projects:
    Http://DominatorLegend.Co.Nr
    .................................................................................................... ................................................................................................
    Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...

  11. #11

    Thread Starter
    Lively Member Dominator's Avatar
    Join Date
    Oct 2004
    Location
    Egypt
    Posts
    65

    Re: Searching for server among my LAN

    thanks a lot for ur advice
    but is there a chance to implement my idea, as searching LAN for a server is needed, many LAN applications don't need to setup the client to know server address it discover it automaticaly, by searching for a listeaners.

    the code i past is working but, if i click the Command1 twice, it show the result at first time, but if i change port and search, nothing found!!! its supposed that sockets object unloaded, so it should connect to new server using new ports!!.

    any idea!!

    Thanks alot
    .........................................................
    John F. Gouda {A.K.A}{Dominator Legend}
    Software Engineer
    +20-0125113313
    .......................................................
    Please feel free to download my projects:
    Http://DominatorLegend.Co.Nr
    .................................................................................................... ................................................................................................
    Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...

  12. #12
    Hyperactive Member
    Join Date
    Oct 2006
    Posts
    354

    Re: Searching for server among my LAN


  13. #13

    Thread Starter
    Lively Member Dominator's Avatar
    Join Date
    Oct 2004
    Location
    Egypt
    Posts
    65

    Re: Searching for server among my LAN

    Hi,

    Thanks for ur post, but what is the use of this SW, i think its a tracer SW.
    i didn't figure out the relation between my app and that sw.

    thanks
    .........................................................
    John F. Gouda {A.K.A}{Dominator Legend}
    Software Engineer
    +20-0125113313
    .......................................................
    Please feel free to download my projects:
    Http://DominatorLegend.Co.Nr
    .................................................................................................... ................................................................................................
    Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...

  14. #14
    Hyperactive Member
    Join Date
    Oct 2006
    Posts
    354

    Re: Searching for server among my LAN

    it called a packet sniffer, you will probably need to be on a hub for it to work fully. However, you can see all the physicall packets entering and leaving your box. This will allow you to debug your program.

    You might need to read up on a TCP/IP packets.

  15. #15

    Thread Starter
    Lively Member Dominator's Avatar
    Join Date
    Oct 2004
    Location
    Egypt
    Posts
    65

    Re: Searching for server among my LAN

    thanks a lot. i will try it.
    .........................................................
    John F. Gouda {A.K.A}{Dominator Legend}
    Software Engineer
    +20-0125113313
    .......................................................
    Please feel free to download my projects:
    Http://DominatorLegend.Co.Nr
    .................................................................................................... ................................................................................................
    Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width