AsyncSocketSample.Server.ProcessSend C# (CSharp) Method

ProcessSend() private method

This method is invoked when an asynchronous send operation completes. The method issues another receive on the socket to read any additional data sent from the client
private ProcessSend ( SocketAsyncEventArgs e ) : void
e System.Net.Sockets.SocketAsyncEventArgs
return void
        private void ProcessSend(SocketAsyncEventArgs e)
        {
            if (e.SocketError == SocketError.Success)
            {
                // done echoing data back to the client
                AsyncUserToken token = (AsyncUserToken)e.UserToken;
                // read the next block of data send from the client
                bool willRaiseEvent = token.Socket.ReceiveAsync(e);
                if (!willRaiseEvent)
                {
                    ProcessReceive(e);
                }
            }
            else
            {
                CloseClientSocket(e);
            }
        }