Question about SocketFactory

Hello, everyone!

I know that I can use subclass of Java to generate special kind of Socket, but I don't know how to specify both local port and remote port, which must be in the 'allow' range of our firewall. I search in google and find nothing. I doubt that this function should be implemented through JNI, etc, all but pure java.

Can anybody give me a sample socket server, written in pure java, which lies behind a firewall and can communicate with client machine propertly.

[500 byte] By [HotFirea] at [2007-11-26 17:36:31]
# 1
Read the socket API, specifically the connect method that takes four arguments.
masijade.a at 2007-7-9 0:04:35 > top of Java-index,Core,Core APIs...
# 2

And you don't need to use a SocketFactory for that, see above.

> Can anybody give me a sample socket server, written

> in pure java, which lies behind a firewall and can

> communicate with client machine propertly.

This has nothing to do with your previous question, which concerns creating client sockets. There is nothing special you need to do in a Java server behind a firewall except just choosing the correct listening port and configuring the firewall correctly.

ejpa at 2007-7-9 0:04:35 > top of Java-index,Core,Core APIs...
# 3
Thanks a lot!
HotFirea at 2007-7-9 0:04:35 > top of Java-index,Core,Core APIs...