[jboss-user] [Remoting] - Re: MasterServerSocket with VirtualServerSocket

ron.sigal@jboss.com do-not-reply at jboss.com
Mon Apr 2 20:04:38 EDT 2007


Hi,

Here is how multiplex works with respect to server sockets. The MasterServerSocket wraps a real server socket, and when a client connects to it (the first time) by calling a VirtualSocket constructor targeted at the MasterServerSocket, the MasterServerSocket creates a real socket and creates a VirtualSocket associated with that socket.  This is how a multiplex connection is created from the client to the server.   

Let's call the multiplex connection MC.  Now, you can attach a VirtualServerSocket to either end of MC, which allows new virtual connections to be added to MC. To attach a VirtualServerSocket to the server side, you need to take an existing VirtualSocket associated with MC and pass it to the constructor


  | public VirtualServerSocket(VirtualSocket socket, Map configuration) throws IOException
  | 

Then the VirtualServerSocket will be bound to the same host and port as the MasterServerSocket, and subsequent connections to that host and port from the other end of MC will be handled by the VirtualServerSocket.  That is, new virtual connections will be added to the single physical connection.  You can see this idea at work in MultiplexServerInvoker.run().

In your situation it sounds like you are restricted to configuring your third party library with a server socket factory, and the existing VirtualServerSocketFactory probably won't work for you, since it was intended for other purposes.  However, you could write your own.  Initialize it with a VirtualSocket and then in each createServerSocket() method call the VirtualServerSocket constructor shown above. 

anonymous wrote : 
  | - Do I have to create VirtualServerSocket on the client side although I don't need any "callbacks", i.e. VirtualSockets on the server connecting explicitly to clients? 
  | 

No.  You would need a VirtualServerSocket on the client side only if you intended to create virtual connections from the server to the client.

anonymous wrote : 
  | - How to allow multiple physical clients to connect to one MasterServerSocket? 
  | 

That is enabled automatically, since the MasterServerSocket wraps a real server socket.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4033868#4033868

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4033868



More information about the jboss-user mailing list