Menu

#3 TCPIPConnection, ungracefull socket close detection

open
nobody
None
5
2011-01-14
2011-01-14
No

In class com.logica.smpp.TCPIPConnection @line 413 (receive() method):

bytesRead = inputStream.read(receiveBuffer, 0, bytesToRead);

returns -1 if the underling socket has been ungracefuly disconnected
causing high CPU usage while using a Reciever thread.

Solution:
add @line 423:

if (bytesRead == -1) {
throw new IOException("Ungraceful TCP socket disconnect");
}

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.