private void EndConnect(IAsyncResult ar) {
            var tcs= (TaskCompletionSource<bool>)ar.AsyncState;
            tcs.SetResult(true);

            var socket = (Socket)tcs.Task.AsyncState;

            var message = new Message {
                Buffer = new byte[socket.ReceiveBufferSize],
                Socket=socket,
            };
            Listen(message,EndReadMessage);
        }
 private void Listen(Message message, AsyncCallback callback) {
     message.Socket.BeginReceive(message.Buffer, message.Count, message.Buffer.Length - message.Count, SocketFlags.None, callback, message);
 }