Two Laptop Bag
The moose likes Sockets and Internet Protocols and the fly likes Unexpected SocketTimeoutException Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply Bookmark "Unexpected SocketTimeoutException" Watch "Unexpected SocketTimeoutException" New topic
Author

Unexpected SocketTimeoutException

Sun LiWei
Ranch Hand

Joined: Aug 10, 2002
Posts: 49
I have a thread which using DatagramSocket in the run() method:
MyThread extends Thread{
public void run(){
try{
DatagramSocket socket=new DatagramSocket();
socket.send(...);
socket.recieve(...);
socket.close();
}catch(Exception e){
e.printStackTrace();
}
}
}
When I generate tens of threads with MyThread, most of the threads run without exception,but there're always some threads throw a SocketTimeoutException,the network is ok though,when i run one thread a time,no exception! I can't figure it out.Help me.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Unexpected SocketTimeoutException
 
Similar Threads
Threads !
about thread synchronization
Daemon Thread
Threads !
synchronization not working properly