O'Reilly logo

Special Edition Using Java™ 2 Enterprise Edition by Mark Wutka

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a Custom Socket

When you use certain technologies such as RMI (Remote Method Invocation), it's tougher to deal with firewalls. RMI normally listens for connections on any free port, so you end up having to open up all ports on the firewall over 1024. If you want to open just one port on the firewall, you can create a relay program that accepts a hostname and port number and then connects to the named host and port.

Caution

It's extremely dangerous to make a relay that allows users outside the firewall to make connections to any address inside the firewall. You have essentially turned off the firewall and opened up your network to the world. You must limit the hosts and ports that you allow the user to connect to.

Although the relay ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required