Exemple #1
0
 public void SendData(byte[] data, Socket client)
 {
     try
     {
         client.BeginSend(data, 0, data.Length, SocketFlags.None, new AsyncCallback(SendMessageCallBack), client);
     }
     catch (SocketException ex)
     {
         ConLost(client);
         ClientSocketList.Remove(client);
         LogWriter.WriteLog_Error(ex);
     }
 }
Exemple #2
0
        private void SendMessage(object _obj)
        {
            AsyncObject obj    = (AsyncObject)_obj;
            Socket      client = obj.SocketWorkingClient;

            byte[] sendData = obj.ByteArray;

            try
            {
                client.BeginSend(sendData, 0, sendData.Length, SocketFlags.None, new AsyncCallback(SendMessageCallBack), obj);
            }
            catch (SocketException ex)
            {
                ConLost(client);
                ClientSocketList.Remove(client);
                if (ex.SocketErrorCode == SocketError.ConnectionReset)
                {
                }
            }
        }