2 Replies Latest reply on Apr 25, 2008 10:33 PM by Ron Sigal

    P2P Client Callback with streaming

    Pat Chang Newbie

      Hi,

      We are keen to build a P2P server which allows multiple clients to register to the server. Each client call to the server should evoke a push to zero or many peers, who would have registered to the group chat earlier.

      Question 1:
      Is it possible to have each clients socket context connection saved in the server so that the server can do a push to the registered clients? I am not too sure if the pull / push callbacks are the right way to go forward. The "Mina" framework offers this feature, if I can remember right.

      Question 2:
      Will the client push from the server work for clients behind NAT firewall.

      Question 3:
      Secondly, we would also like to utilize the streaming feature to distribute documents among peers. Can the similar solution be used for streaming documents among group

      Kindly advice,
      Pat

        • 1. Re: P2P Client Callback with streaming
          Pat Chang Newbie

          Can someone help/guide me please. Your help will be much appreciated. Our project is currently stuck due to this.

          I would like to attach a new URL http://mina.apache.org/documentation.html#Documentation-Examples which gives the example of how MINA achieves the same objective.

          Thank you,
          Patrick

          • 2. Re: P2P Client Callback with streaming
            Ron Sigal Master

             


            Question 1:
            Is it possible to have each clients socket context connection saved in the server so that the server can do a push to the registered clients? I am not too sure if the pull / push callbacks are the right way to go forward. The "Mina" framework offers this feature, if I can remember right.


            Yes. Each client could call org.jboss.remoting.Client.addListener() which, depending on the details of the call, will register an implementation of org.jboss.remoting.callback.InvokerCallbackHandler to receive push (or polled) callbacks. On the server side, your implementation of org.jboss.remoting.ServerInvocationHandler will be informed of the existence of the newly registered InvokerCallbackHandler through a call to ServerInvocationHandler.addListener(). Your ServerInvocationHandler can add the InvokerCallbackHandler to a list of InvokerCallbackHandlers waiting for callbacks.


            Question 2:
            Will the client push from the server work for clients behind NAT firewall.


            Yes. Push callbacks are processed by a client-side callback Connector. You can create the callback Connector with "clientConnectAddress" and "clientConnectPort" parameters which will tell the server how to connect to the callback Connector.


            Question 3:
            Secondly, we would also like to utilize the streaming feature to distribute documents among peers. Can the similar solution be used for streaming documents among group


            This one's a little tricky. Streaming is not a fully developed feature in the current version of Remoting. It is possible to send streams from the client to the server. There is not currently an explicit mechanism for sending streams from the server to the client. However, push callbacks are handled by creating an org.jboss.remoting.Client on the server side and then calling Client.invoke(). Your implementation of ServerInvocationHandler.addListener() could cast the incoming InvokerCallbackHandler to org.jboss.remoting.callback.ServerInvokerCallbackHandler and call ServerInvokerCallbackHandler.getCallbackClient() to get the Client used to send push callbacks. I guess you could then use that callback Client to send streams to the client-side callback Connector. I've never tried it, but it sounds plausible.

            By the way, there's a sample chat room application in org.jboss.remoting.samples.chat.*. I wrote it a long time ago and don't remember much about it, but it does use callbacks.

            I'm sorry if my answer was too late to be of any use.