Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default Accept Connect Request and Read Broadcast

    Hello, this is my first time on this forum. I'm looking for some advice because I'm not sure of the best way to proceed. Here it goes.....

    I have a client/server application up and running. At this point I'd like to allow the client to broadcast on the local network to find out which computer is the server. That way it can connect with the IP address retrieved and the user doesn't have to worry about knowing the servers IP address.

    Right now my server simply sits and waits for connect requests and creates a thread for each one that comes in (since this is for a room full of 20 computers the multi-threading way I hope works out fine).

    I've looked over the API for MulticastSocket.

    My questions are...

    Is multicastSocket the preferred or only way to read in broadcasts?
    Should I add a thread for reading in broadcasts? Is this a good way to do it?
    If there are two threads one for ServerSocket and one for MulticastSocker should they use different ports?

    Any advice beyond answering the questions above is welcome.

    Thanks.

  2. #2
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    You may want to think some more about your strategy. How will you ensure there is only one server on the network? How will you prevent spoofing or man-in-the-middle? Discovery by broadcast will limit the application to flat, non-routed networks -- is that really what you want? If this is a custom app for a particular organization, wouldn't it be better to simply use DNS to find the server?

    -Gary-

  3. #3
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default

    Thank you for the reply.

    I am fine with there being more than one server application on the network. In practice in may not happen but if it was attempted I would not forbid it.

    To be more specific, broadcasting to retrieve a servers IP will merely be an option on the user interface. The user will still have the ability to specify an IP if desired. The primary and perhaps only users will all be on a local network in the same room. If all the users are connected via a router for instance all their IP addresses are 192.168.1.2-20 the MulticastSocket.joinGroup would still be able to broadcast throughout that network correct? In the end it is just a convenience feature for the expected user base. Since some of them in all likelihood will have to ask what is an IP address.

    This is just a client application running on several computers in a room and a corresponding server application running on one (in most cases) of the other computers in that room. I'm not sure how using DNS could tell me which of those computers is running this app. If that is possible could you elaborate on it for me please.

    Thanks.

Similar Threads

  1. How to block Client request to connect with server
    By mfaizan24 in forum Networking
    Replies: 3
    Last Post: 02-28-2010, 08:26 PM
  2. fake ARP broadcast packet
    By junkredish in forum Networking
    Replies: 0
    Last Post: 09-06-2008, 07:01 PM
  3. broadcast messaging
    By bhanu in forum Networking
    Replies: 1
    Last Post: 10-30-2007, 12:41 PM
  4. variable to accept a single object
    By Rgfirefly24 in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 05:41 AM
  5. Accept 2 values ....
    By danny000 in forum New To Java
    Replies: 1
    Last Post: 07-31-2007, 03:12 PM

Posting Permissions

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