commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Corey Scott <corey.sc...@gmail.com>
Subject Re: [email] dumbster *nix
Date Thu, 04 Nov 2004 13:31:15 GMT
In addition to this (and to post to this list, what we have been
discussion privately).  I have added a method to the dumbster which
takes a server socket as an input instead of a port number.  The
advantage of this is that you can create the server socket using:
ServerSocket newSocket = new ServerSocket(0); // NOTE the 0 (see below)
server = SimpleSmtpServer.start(newSocket);
int intServerPort = newSocket.getLocalPort();

NOTE: from the java.net.ServerSocket javadoc:
parameter -> port - the port number, or 0 to use any free port. 

With all this, we should be able to 'happily' use intServerPort
returned to configure our mail classes.

Conclusion, all goes well, dont need to hardcode any port numbers as
the code should take care of itself.  This would mean that we get past
this damn thing and on to something more useful :-)

Cheers,
Corey

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message