Results 1 to 2 of 2
  1. #1
    priyamurugar is offline Member
    Join Date
    Apr 2010
    Rep Power

    Default How to write two server program in java

    hi all.....

    I wrote the java program as 1 server and many clients... It works fine....

    Now I want to write 2 server prog and many client prog....

    If one server fails, another one act as server for the clients....

    Can anyone give me idea for writing the java prog for two servers

  2. #2
    Debbie is offline Member
    Join Date
    Apr 2010
    Rep Power



    Surely it depends what failure you're trying to derisk? As depending on what the problem is, you may be better off having two separate java apps, possibly on different machines, each running a server.

    You can't run 2 servers on the same port on the same server, as the first will have already bound to the port and the second will error. You could catch the second erroring, and retry every Xmins. This would then reinitialise the connection when the first one has failed. However, you could just make the original server catch any errors it may throw, and reinitialise itself.

    Alternatively, you actually run a second server on a second port, and clients are coded to redirect to the second server on failure to connect with the first. This could then be on a separate machine which would protect from the one machine going offline etc.

    Once you've decided what behaviour you want and the issue you're trying to avoid then it'll be clearer as to what you need!


Similar Threads

  1. Replies: 13
    Last Post: 04-16-2010, 03:51 AM
  2. Applet Server Write Permission
    By Look2Logic in forum New To Java
    Replies: 0
    Last Post: 04-13-2010, 10:21 PM
  3. Replies: 0
    Last Post: 04-04-2008, 03:49 PM
  4. need help to write Program in JAVA
    By maneibr in forum New To Java
    Replies: 1
    Last Post: 03-13-2008, 02:28 PM
  5. Replies: 1
    Last Post: 02-15-2008, 05:07 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