shekinskiy
Programmer
hi
i have a server socket and more that 200 client socket,
i get exception above in client socket and my codes is bellow.
recieve and send method is same in both socket; client and accepted socket, except SoTimeout.
thanks for any help,
i have a server socket and more that 200 client socket,
i get exception above in client socket and my codes is bellow.
Code:
//open method
ServerSocket listener=new ServerSocket(port,Integer.MAX_VALUE);
....
//accept method in loop in thread
listener.setSoTimeout( 100000000L );
Socket acceptedSocket = listener.accept();
....
//receive method in loop in new thread for each conn.
inputStream = new BufferedInputStream( acceptedSocket.getInputStream(), 2048 );
outputStream = new BufferedOutputStream( acceptedSocket.getOutputStream(), 2048 );
long longSoTimeoutForClientSocket = 10000L;
long longSoTimeoutForAcceptedSocket = 7200000L;
acceptedSocket.setSoTimeout( longSoTimeout );
inputStream.read( byte[4096], 0, 4096 OR inputStream.available() );
....
//send method
acceptedSocket.setSoTimeout( 1000L );
outputStream.write( data.getBuffer(), 0, data.length() );
outputStream.flush();
recieve and send method is same in both socket; client and accepted socket, except SoTimeout.
thanks for any help,