Closing socket on ClientConnection.disconnect [message #23539] |
Wed, 03 April 2002 20:50  |
Eclipse User |
|
|
|
The ClientConnection.disconnect() methods needs to close the socket,
otherwise the socket remains open until the Eclipse client is shutdown
even though the server has ended (the server end of the socket remains in
finished wait state, waiting for the client to end the connection.) The
following code accomplishes this:
public void disconnect()
{
if (_isConnected)
{
_dataStore.setConnected(false);
if (_isRemote)
{
_commandHandler.command(_dataStore.find(_dataStore.getRoot() ,
DE.A_NAME, "Exit"),
_dataStore.getHostRoot(),
// true);
false);
_receiver.finish();
}
_commandHandler.finish();
try
{
Thread.currentThread().sleep(200);
}
catch (InterruptedException e)
{
System.out.println(e);
}
_updateHandler.finish();
_dataStore.flush();
try {
_theSocket.close();
} catch (IOException e) {
// Log the error ???
}
_isConnected = false;
}
}
Don Yantzi
Software Developer
IBM Toronto Lab
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.15408 seconds