[2464] in java-interest

home help back first fref pref prev next nref lref last post

How to bind a socket in Java beta release

daemon@ATHENA.MIT.EDU (Carl Resnikoff)
Tue Oct 3 00:25:31 1995

Date: Mon, 2 Oct 1995 11:49:23 -0700
From: cfr@netcom.com (Carl Resnikoff)
To: java-interest@java.Eng.Sun.COM

I have a server application which runs nicely in Java alpha 3,
and I've run across a problem I don't know how to solve in
porting to Beta.
In alpha 3, my server is listening on a socket that I bound using 
socket.bindToPort(localAddr, localPort).
Since my server my might be listening on more than 1 network,
I need to specify localAddr. It might be 127.0.0.1 (loopback),
it might be my machine's address on a LAN, it might be my machine's PPP
address.

Unfortunately, socket.bindToPort() is gone, and there is no equivalent
in ServerSocket. Looking at the code in ServerSocket.java and InetAddress.java,
It seems that ms that the local address is gotten from
	private static native String getLocalHostName(), 
which I have no control over.

Any suggestions how I can specify what socket to listen on?
	thanks,
	Carl Resnikoff
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post