aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes Unexpected SocketTimeoutException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
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://aspose.com/file-tools
 
subject: Unexpected SocketTimeoutException