Firewall detection by applets
Hi all,
we have implemented a messenger using Java...now we wish to add a file transfer feature to it. We wish to make it a peer to peer transfer depending on whether the client side applet is behind a firewall or not.
My question is: how can the client side applet detect whether it is behind a firewall or not and send relevant information to the server?
Thankx in advance..
AslamM
[421 byte] By [
AslamM] at [2007-9-26 17:12:55]

I don't know of any API that specifically allows to do that, but one possible start would be to do the following:
1. the client contacts the server passing it IP address and asking for an ackowledgement.
2. the server then tries to "ping" the client using the IP that it has been provided by the client.
3. then some kind of time-out system both on the client and the server will allow you to find-out if the connection was successful or not. If it was, then the client is probably not behind a firewall, or the port you are using is open. If not, then chances are either the client is behind a firewall, or does not have a real IP, and therefore is not contactable directly on the internet.
As I said earlier, this is just a start and you'll probably discover more problems, but I hope this helps.
- Dan