Johaness Springel

Greenhorn
+ Follow
since Apr 21, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Johaness Springel

Yes, it's true, but I don't close it explicitly. And I don't see that connect method does it. Moreover if socket was closed, then during second connection try there would be message:
java.net.SocketException: Socket is closed

(according to source code of class Socket) which is different from the one I get.
Hi,

I use socket to connect first to one service, but if the connection fails (is refused)
then I want to reuse this socket to connect to different service. But when I try to
connect to second service (which I'm sure works) I get:
java.net.SocketException: Socket operation on nonsocket: connect

when I call connect() method. Does anybody know why?

The code below reproduces this problem (I use Windows XP and Java 1.5)


public class Runner {

public static void main(String[] args) throws Exception {
new Thread(new Runnable() {
public void run() {
try {
ServerSocket ss = new ServerSocket(50007);
Socket s = ss.accept();
} catch (Exception e) {
System.out.println(e);
}

}
}).start();

Thread.sleep(5000);

Socket socket = new Socket();
InetSocketAddress localAddress = new InetSocketAddress(50000);
socket.bind(localAddress);

try {
socket.connect(new InetSocketAddress("localhost", 50006));
} catch (Exception e) {
System.out.println(e);
}
try {
socket.connect(new InetSocketAddress("localhost", 50007));
} catch (Exception e) {
System.out.println(e);
}
}
}
Hi,

we're developing highly available web application and now we want to introduce possibility to execute on server simple scripts (JavaScript) created and uploaded by users of application. The problem is that scripts will be not verified by us and a user may upload script that will cause problems on our servers (e.g. infinite loop, too big memory consumption). The application must be highly available and users must be isolated (problems of one user can not influence other users) so we need some solution for problems with malicious scripts. We run small cluster of J2EE containers with BEA Weblogic 92.

Any ideas how to implement this?
14 years ago