0

Say Client A want to create a SocketServer but not in his phone, is in the outside Server. Then Client B can connect the SocketServer in the outside Server. Then A and B can communicate.

My idea is: Outside Server has a thread keep running to listen Client A request. When it receives client A request. The outside Server open a new SocketServer with new port. Then both client A and client B will both connect to the new SocketServer created by the outside Server. Finally client A and client B can communicate.

Above is just my idea, do you thing that it is possible? You may give me some pseudo codes. Many thanks!

Let me say it in more detailed way. For example, client A want to create a chat room, but client A doesn't want to be a server. So client A sends a message to the outside Server ans ask the outside Server create a chat room for client A. Is it possible to do that? What will be implementation of the outside server?**

  • 1
    Area you writing about some sort of p2p relay? Why not use RMI then? – Antoniossss Oct 22 '13 at 07:18
  • O...I don;t know what is RMI. Can you explain me what is RMI? And how can I make good use of it? I am not sure it is p2p or not. Since actually Client C can connect to the SocketServer too. – user2894168 Oct 22 '13 at 07:44

1 Answers1

0

RMI - Remote Method Invocation By using it you can implement simple communication relay. What would it do?

  1. Allow registration for clients awaiting connections
  2. Choose to whitch client you want to connect
  3. Pass needed information like client IP address and its listening port

And all other aspects you will have to consider. Here you have compleate tutorial about RMI.

Antoniossss
  • 31,590
  • 6
  • 57
  • 99