예제 #1
0
        public void SendReply(ConnectedObject ConnectedObject, object data)
        {
            if (ConnectedObject is null)
            {
                Log.PrintMsg("Unable to send reply: ConnectedObject null");
                return;
            }

            try
            {
                Message messageReply = Map.Serialize(data);

                ConnectedObject.Socket.BeginSend(messageReply.ByteBuffer, 0, messageReply.ByteBuffer.Length, SocketFlags.None, new AsyncCallback(SendReplyCallBack), ConnectedObject);
            }
            catch (SocketException exception)
            {
                Log.PrintMsg(exception);
                CloseClient(ConnectedObject);
            }
        }