I must admit I'm very confused. This is not a new state, just an irritating one.![]()
Anyway, I'm trying to open a ServerSocket on a 9500 using the Personal Profile (no generic connection framework stuff) and in one application (an HTTP Server) I open the socket this way
ServerSocket serverSocket = new ServerSocket(new Integer(System
.getProperty("utils.Httpd.port", "84")).intValue());
try {
while (true) {
Socket socket = serverSocket.accept();
System.out.println("Connection Made from " + socket);
Httpd httpd = new Httpd(socket);
Thread th = new Thread(httpd);
th.start();
} // end while true
} catch (Exception e) {
}
This works great! No problem. I close that application, go to a 2nd app and open the server socket this way.
int serverSocketPort = 1313;
try {
JoinableServicesCache.serverSocket = new ServerSocket(
serverSocketPort);
} catch (IOException e) {
System.out.println("JoinableServicesCache.JoinableServicesCache()");
System.out.println("Error - unable to execute "
+ e.toString());
try {
System.out.println("Addresss:" + InetAddress.getLocalHost());
} catch (UnknownHostException e1) {
System.out.println("Error - UnknownHostException "
+ e1.toString());
System.out.println(serverSocket);
}
e.printStackTrace();
System.exit(-1);
}
This call to open a server socket results in an exception and the output
JoinableServicesCache.JoinableServicesCache()
Error - JMatos unable to execute java.net.BindException: The address is not available
Addresss:localhost/127.0.0.1
I then tried an example out of Elliotte Rusty Harold's "Java Network Programming" and gave more args to the open socket call but to no avail. That call was
ServerSocket httpd = new ServerSocket(1313,10,InetAddress.getByName("192.168.1.112");
This resulted in the same thing. (I know the address because I can ping it).
The only difference that I can see is that one is a local variable and other is a static but I don't think that should make and difference.
Anyone have any ideas of what to try?
Thanks
Cam

Reply With Quote

