[e-lang] Redirectories and captp://

David Hopwood david.nospam.hopwood at blueyonder.co.uk
Tue Sep 14 13:01:43 EDT 2004

Tyler Close wrote:
>         System.out.println("Determining local address...");
>         InetAddress address = InetAddress.getLocalHost();

This gets the host's current IP address. What you want is the "wildcard"
address (equivalent to INADDR_ANY in C), although that can't be represented
as an InetAddress.

>         System.out.println("Localhost is: " + address);
>         System.out.println("Opening socket...");
>         ServerSocket socket = new ServerSocket(80, 50, address);

           ServerSocket socket = new ServerSocket(80, 50);

(This should be equivalent to "socket.bind(new InetSocketAddress(80), 50)".)

I haven't tested whether this actually works when the host's IP changes.
In theory it should cause INADDR_ANY to be passed to the C socket API, which
should work, but it's the kind of thing that might be platform-dependent.

David Hopwood <david.nospam.hopwood at blueyonder.co.uk>

More information about the e-lang mailing list