Beispiel #1
0
        public virtual void Send(byte[] packet)
        {
            isSending.WaitOne();
            this.isConnecting.WaitOne();

            if (this.socket.Connected)
            {
                this.socket.BeginSend(packet, 0, packet.Length, SocketFlags.None, new AsyncCallback(x =>
                {
                    YMSGConnection yc = x.AsyncState as YMSGConnection;
                    int bytesSent     = yc.socket.EndSend(x);
                    yc.OnNotify(new YMSGNotification(bytesSent.ToString(), null)
                    {
                        NotificationType = YMSGNotificationTypes.BytesSent
                    });
                    yc.isSending.Set();
                }), this);
            }
        }