Esempio n. 1
0
        public void SendMess(string Mess)
        {
            byte[]     byt     = System.Text.Encoding.UTF8.GetBytes(Mess);
            SendObject SendBuf = new SendObject(byt, ClientSocket);

            ClientSocket.Send(SendBuf.SendBuf, 0, SendBuf.SendBuf.Length, SocketFlags.None);
        }
Esempio n. 2
0
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="Client">客户端IP</param>
        /// <param name="SendBuffer">发送数据</param>
        public bool SendMess(byte[] SendBuffer)
        {
            SendObject SendBuf = new SendObject(SendBuffer, ClientSocket);

            ClientSocket.BeginSend(SendBuf.SendBuf, 0, SendBuf.SendBuf.Length, SocketFlags.None, new AsyncCallback(SendCallback), SendBuf);
            return(true);
        }
Esempio n. 3
0
        private void SendCallback(IAsyncResult ar)
        {
            SendObject SendState  = (SendObject)ar.AsyncState;
            int        SendCount  = ClientSocket.EndSendTo(ar);
            MessBuffer SendBuffer = new MessBuffer(SendState.SendBuf, ClientSocket);

            OnSend(SendBuffer);
        }