Results 1 to 9 of 9
  1. #1
    init is offline Member
    Join Date
    Mar 2010
    Posts
    5
    Rep Power
    0

    Default how to connect two servers??

    I have a server which can handle multiclients by multithreading.now i want this server to chat and connect with another same server..how to do that?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,436
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by init View Post
    I have a server which can handle multiclients by multithreading.now i want this server to chat and connect with another same server..how to do that?
    Can your server act as if it were a client? If so I don't see any problems.

    kind regards,

    Jos

  3. #3
    init is offline Member
    Join Date
    Mar 2010
    Posts
    5
    Rep Power
    0

    Default

    server only passing the clients message from 1 client to another simultaneously....

  4. #4
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    5

    Default

    Quote Originally Posted by init View Post
    server only passing the clients message from 1 client to another simultaneously....

    it depends on the implementation. a server can also broadcast a message to all connected clients.

  5. #5
    init is offline Member
    Join Date
    Mar 2010
    Posts
    5
    Rep Power
    0

    Default t depends on the implementation. a server can also broadcast a message to all connect

    i want to braodcast message to clients connected to another server of same kind..how to do that?

  6. #6
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    5

    Default

    Quote Originally Posted by init View Post
    i want to braodcast message to clients connected to another server of same kind..how to do that?
    the pseudo-code sound like:

    1) when a client connect to the server then the server register this connections in a thread-collection and creates a new thread to handle that connection
    2) when a client send a message to the server, the server add the username + " says: " + message to the string message and then loops through his threads-collection and for each client he executes a client[x].send(message);

    if you want to broadcast clients connected to another server then you need a reference to the collection of all clients from the other server.

  7. #7
    init is offline Member
    Join Date
    Mar 2010
    Posts
    5
    Rep Power
    0

    Default

    ya..i got what u r saying!!! that means that the another server will deal the first server as a client!!

  8. #8
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    5

    Default

    Quote Originally Posted by init View Post
    ya..i got what u r saying!!! that means that the another server will deal the first server as a client!!

    sure, if the "other" server is able to broadcast you can connect as a client and when you send a message to the "other" server all connected clients to the "other" server should receive your message. so you don't need to know anything about the client-collection on the "other" server.

  9. #9
    init is offline Member
    Join Date
    Mar 2010
    Posts
    5
    Rep Power
    0

    Default

    thanx ..
    implementation wise ..how to do that(how server can act as client)??now what i am doing..i create a thread if any client request comes.

Similar Threads

  1. Copy files between servers
    By mcoto800 in forum Java Servlet
    Replies: 1
    Last Post: 02-05-2010, 01:05 AM
  2. subforum for servers
    By tushar88 in forum Suggestions & Feedback
    Replies: 3
    Last Post: 03-10-2009, 02:25 AM
  3. [SOLVED] connecting two servers at atime
    By sandeepsai39 in forum JDBC
    Replies: 3
    Last Post: 02-25-2009, 05:56 AM
  4. Servers supporting EJBeans
    By ravian in forum Enterprise JavaBeans (EJB)
    Replies: 3
    Last Post: 01-03-2008, 10:44 AM
  5. Looking for servers on ports
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-13-2007, 09:28 AM

Posting Permissions

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