Finding a server

This is a discussion on Finding a server within the Networking/Device Communication forums, part of the General Programming Boards category; Hi, i have a small problem. I wrote a server application running on a linux pc. Now this pc gets ...

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    20

    Finding a server

    Hi,

    i have a small problem.
    I wrote a server application running on a linux pc. Now this pc gets conencted to a network with DHCP server, from which it receives its ip.

    My problem is now that i run another programm on a windows pc, which has to find the linux server.

    I read something about broadcasts, but i dont know if its the right approach.

    Thanks for your time.

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    Is the windows PC and the linux PC on the same network? What stops you from assigning the linux PC's IP address statically?

  3. #3
    Registered User Kybo_Ren's Avatar
    Join Date
    Sep 2004
    Posts
    136
    Yes, I'd set the broadcast flag and send a message with something like, "<app name> BROADCAST" to 255.255.255.255 on your application's port. Then the other computer can respond and they can initiate the connection.

  4. #4
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    Keep in mind that will only work if the SO_BROADCAST socket option is set, and the other computer is on the same LAN.

  5. #5
    Registered User
    Join Date
    Sep 2004
    Posts
    197
    Is there some way you could make the servers ip or hostname a config option? this way you don't have to search, and its not restricted to LAN use.
    If any part of my post is incorrect, please correct me.

    This post is not guarantied to be correct, and is not to be taken as a matter of fact, but of opinion or a guess, unless otherwise noted.

  6. #6
    Registered User
    Join Date
    Dec 2004
    Posts
    20
    Thank you very much.

    I got some problems understanding how broadcasts work.
    If anybody could post a link to a good explanation/example
    i would appreciate it.
    My problems are:
    the client sends the broadcast as udp packet, do i have then to implement the answer or will it be automatically?
    And can broadcasts be only on specific ports?

  7. #7
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    do i have then to implement the answer or will it be automatically?
    You have to answer. Traditionally you would send back the IP address to the client, so it could connect back to the server.

    And can broadcasts be only on specific ports?
    Well it can be on any port.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Server Architecture
    By coder8137 in forum Networking/Device Communication
    Replies: 2
    Last Post: 01-29-2008, 10:21 PM
  2. Where's the EPIPE signal?
    By marc.andrysco in forum Networking/Device Communication
    Replies: 0
    Last Post: 12-23-2006, 07:04 PM
  3. SMTP Server Not Working
    By (TNT) in forum Networking/Device Communication
    Replies: 1
    Last Post: 07-15-2003, 05:33 AM
  4. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM
  5. socket question
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 07-19-2002, 01:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21