On Wed, Jun 10, 2009 at 2:30 PM, Kirk Ouimet<[email protected]> wrote: > When the application starts up, I want it to initiate a connection to my web > server. From my current understanding, the router will automatically use port > address translation to understand which machine behind the firewall the > original message came from. The router will send a message to the web server > with the request and a randomly generated port for the server to respond back > on. The server will then send a response back on that random port, the router > will receive the response, know which machine is tied to the request (using > the random port as the key), and then forward to response to that particular > machine.
If you cannot control the firewall in question, you will need to have all network connections initiated from the inside of the firewall. You will have two options for "bi-directional" communication, Push or Pull (poll). Polling involves the java application contacting your server periodically. This is easy to program on the web server side (RPC, SOAP, REST, etc). The client just needs some form of scheduled polling system, again, not very hard. Push will require the client opening up a single long running connection to your web server. This is much more difficult. You will need to either mess with HTTP keepalive, or run a separate multi-threaded daemon to manage the connections. Over this connection you may need to come up with some message passing protocol of your own (perhaps protobuf). Also your client will need to include code to monitor the connection, and re-connect as necessary. Pull is easy, but introduces a manual delay for message passing. Push is hard, but gives you near instantaneous response. Any way you choose, all connections need to be initiated by the client, and no firewall/port forward knowledge is necessary. Simple outbound connections. --lonnie _______________________________________________ UPHPU mailing list [email protected] http://uphpu.org/mailman/listinfo/uphpu IRC: #uphpu on irc.freenode.net
