Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Searching network for server

  1. #1
    Junior Member
    Join Date
    Nov 2010
    Posts
    6
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question Searching network for server

    I've been pondering this for a while, and so i decided to join these forums to see if one of you could possibly point me in the right direction;

    I'm wondering whether it's possible to search the network for a server on a specific port?

    I.e. without a specified IP as the server class can be executed on a number of machines, however only one instance should be running and other clients would search the network to see if there is a service on port say 1234, if there is, it connects if not, it acts as the server and other clients can then connect to it.

    I'm not sure whether I've explained myself fully and/or made a complete tool of myself.

    Thanks,


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Searching network for server

    If you have a list of IP addresses for each possible machine, then loop through searching one at a time. If you don't have a list, how would you even go about starting a search?

  3. The Following User Says Thank You to copeg For This Useful Post:

    Jonathan_C (November 14th, 2010)

  4. #3
    Junior Member
    Join Date
    Nov 2010
    Posts
    6
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: Searching network for server

    That's why i was wondering

    So i could simply use a loop to go through each ip?

    so say the range started at 192.168.1.2

    i could just increment the last digit? And if a server is found, it connects, if not it acts as the server.
    Sweet!

Similar Threads

  1. [SOLVED] Interpolation Search for Strings ??
    By george in forum Algorithms & Recursion
    Replies: 3
    Last Post: May 18th, 2010, 06:11 AM
  2. search problem
    By farvi_buet in forum What's Wrong With My Code?
    Replies: 0
    Last Post: May 8th, 2010, 01:26 PM
  3. Has anybody used Java Search Engine?
    By jayab in forum Member Introductions
    Replies: 2
    Last Post: April 26th, 2010, 04:23 AM
  4. google search
    By nasi in forum Java Theory & Questions
    Replies: 7
    Last Post: April 2nd, 2010, 03:13 AM
  5. Breadth First Search Problem
    By Flash8 in forum Algorithms & Recursion
    Replies: 0
    Last Post: March 14th, 2010, 07:27 PM