Re: RMI callback on exist socket connection.
Gregg Wonderly <[email protected]>
| Newsgroups | gmane.comp.java.sun.rmi |
|---|---|
| Message-ID | <[email protected]> |
lamb liu wrote: > Generally, if I want to initiate callback from RMI server to a > client(for notification, etc...) > I need to export the client object , > Thus JDK will try to setup another socket on the server to connect back. > This method will incur many problem especially when client is behind a > proxy. > > I wonder if it is another method to implement callback on established > connection. > In theory, it is possible, since this connection is full duplex > connection, thus server > can send data back. > But I never found clear implementation on this issue. > Sun's RMI faq points out: it is not normally possible. So how can I do > it abnormally? > Does a solution exist?Or I must do it by myself? As many have commented, there are some commerial and Open source items to look at. In the end, you'll have to decide. I usually don't use a callback if the data volume is more than a single response. Instead, I have the server open a port and wait for a cookie. The server sends a proxy back to the client that, apon deserialization, connects back to the server, ands sends the cookie. The server than goes into data transmission mode. The API implemented by the proxy then uses InputStream.read() to get the data from the server and return it to the calling context. The RemoteSocketStream class in http://logman.jini.org provides this mechanism to allow you to remotely monitor the java.util.logging data of a remote server. Any mechanism that will work, implies a constant connection from the client to the server since there is no routable path from the server to the client. The trick is to be able to create a single connection to the server for all possible clients. Usually, that's not possible. Gregg Wonderly =========================================================================== To unsubscribe, send email to [email protected] and include in the body of the message "signoff RMI-USERS". For general help, send email to [email protected] and include in the body of the message "help". For a list of frequently asked RMI questions please refer to: http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html To view past RMI-USERS postings, please see: http://archives.java.sun.com/archives/rmi-users.html