Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public async Task <R> CallAsync(T data)
        {
            var socket = new Socket(AddressFamily.Unspecified, SocketType.Stream, ProtocolType.Tcp);

            socket.Connect(_config.GetEndPoint());
            await socket.SendDataAsync(data);

            //return default(R);
            return(await socket.ReadAsync <R>());
        }
Exemplo n.º 2
0
 private void SetupSocket()
 {
     _listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     _listener.Bind(_config.GetEndPoint());
     _listener.Listen((int)SocketOptionName.MaxConnections);
 }