hey al c# experts. im developing a client server application. when a client is connected to the server server detects it & perform some operation. here, i want to disconnect the client connection by the server side after the operation automatically. im using multi threading asymetric communication techniqe to handle multiple clients. what is the correct procedure to disconnect the client by the server's end? to disconnect a client , can i use
the_sockpack.currentSocket.close();
when im using it, an error is given at waitfordata() function. it says that " cant access disposed objects ".
thank you
Loading

Mike GoldRank #50 · 30.6K reputationPosted Jun 18, 2007, 6:24 PM EDT
anushka thialkarathne15 reputationPosted Jun 19, 2007, 1:23 AM EDT
Posted Oct 15, 2007, 1:59 AM EDT
DWORD WINAPI clientHandleThread(LPVOID threadInfo) { // some related stuff ... // get the client connection: receiving messages from // client & sending messages to the // client will all be done by using this client connection myTcpSocket* clientConnection = clientArgument->getClientConnect(); string clientName = clientArgument->getHostName(); // the server is communicating with this client here while(1) { string messageFromClient = ""; // receive from the client int numBytes = clientConnection->recieveMessage(messageFromClient); // send to the client // ... construct a message to send, saved in messageToClient clientConnection->sendMessage(string(messageToClient)); // other possible stuff ... } return 1; }where there id return 1 in my this one u can keep zero n close the thread and the message if needed