Tomcat, open a socket - doesn't work
My web-app needs to talk to a device in my local network via a soket. I am trying to open a ServerSocket on port > 45000 and listen to it for incoming connections. The class that implements this worked perfectly well while i was developing it and running it as a stand-alone thing, but it throws an exception when i try to run it as a part of my web-app under Tomcat.

What can i do to fix it? I do need to listen to that port, and it is not HTTP traffic that i receive through it, so i can't listen to it by opening it in the config.xml file. 

Here is, basically, the code that fails:
<code><pre>
private void start() {
	ServerSocket s = 0;
	try {
		s = new ServerSocket(45678); // this is line 38 (see stacktrace)
	} catch (IOException e) {
		Misc.log("Could not listen on port: 45678.\n" + Misc.getStackTrace(e));
//		System.exit(-1);
	}
	...
}
</pre></code>

Here is the stacktrace: 
<pre>
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(Unknown Source)
        at java.net.ServerSocket.bind(Unknown Source)
        at java.net.ServerSocket.&lt;init&gt;(Unknown Source)
        at java.net.ServerSocket.&lt;init&gt;(Unknown Source)
        at x.x.x.userland.logging.WebServer.start(WebServer.java:38)
        ...
</pre>

Thanks for your help.
Best regards, 
Timofey.
Tomcat, open a socket - doesn't work
===

My web-app needs to talk to a device in my local network via a soket. I am trying to open a ServerSocket on port > 45000 and listen to it for incoming connections. The class that implements this worked perfectly well while i was developing it and running it as a stand-alone thing, but it throws an exception when i try to run it as a part of my web-app under Tomcat.

What can i do to fix it? I do need to listen to that port, and it is not HTTP traffic that i receive through it, so i can't listen to it by opening it in the config.xml file. 

Here is, basically, the code that fails:
<code><pre>
private void start() {
	ServerSocket s = 0;
	try {
		s = new ServerSocket(45678); // this is line 38 (see stacktrace)
	} catch (IOException e) {
		Misc.log("Could not listen on port: 45678.\n" + Misc.getStackTrace(e));
//		System.exit(-1);
	}
	...
}
</pre></code>

Here is the stacktrace: 
<pre>
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(Unknown Source)
        at java.net.ServerSocket.bind(Unknown Source)
        at java.net.ServerSocket.&lt;init&gt;(Unknown Source)
        at java.net.ServerSocket.&lt;init&gt;(Unknown Source)
        at x.x.x.userland.logging.WebServer.start(WebServer.java:38)
        ...
</pre>

Thanks for your help.
Best regards, 
Timofey.