[UPHPU] Bi-directional Communication Through a Firewall
Walt Haas
haas at xmission.com
Fri Jun 12 09:44:15 MDT 2009
Orson Jones wrote:
> Kirk Ouimet wrote:
>> I want to do some fancy magic with this whole process, where my web server
>> will actually record the port that the original request came through on and
>> then use that port to send data back as needed. Essentially I want to open up
>> persistent HTTP connection in order to circumvent any firewall that may be in
>> place.
The firewall will in general assign a random source port to every TCP
connection, so saving the port number won't work.
> No need for fancy stuff, just establish a persistent HTTP connection from
> the java client to your server. When the server needs to send a job to the
> client, it just sends the data down the established persistent connection.
>
> http://java.sun.com/j2se/1.5.0/docs/guide/net/http-keepalive.html
If you really have thousands of copies of the app running, persistent
connections might not scale high enough. But you could accomplish
almost the same thing by having the app poll your server periodically.
If the app knows what information it needs to exchange, it won't matter
if the firewall assigns a different source port.
-- Walt
More information about the UPHPU
mailing list