Beispiel #1
0
        private void SendCallbackFlag(IAsyncResult ar)
        {
            var client = (TransferObject)ar.AsyncState;

            client.Socket.EndSend(ar);
            var data = new TransferObject();

            data.Buffer = new byte[TransferObject.size];
            data.Socket = client.Socket;
            client.Socket.BeginSend(Encoding.UTF8.GetBytes(selectObject), 0, selectObject.Length, SocketFlags.None, SendCallback, data);
        }
Beispiel #2
0
        private void ConnectCallback(IAsyncResult ar)
        {
            SelectObject();
            var client = ar.AsyncState as Socket;
            var data   = new TransferObject();

            data.Buffer = new byte[TransferObject.size];
            data.Socket = client;
            client.EndConnect(ar);

            client.BeginSend(Encoding.UTF8.GetBytes(flag), 0, flag.Length, SocketFlags.None, SendCallbackFlag, data);
        }