コード例 #1
0
        //
        // Receives data from an unconnected socket
        //
        public int ReceiveFrom(ArraySegment <byte> buffer, ref SocketAddress address)
        {
            var result = TaskToSync.Run(() => ReceiveFromAsync(buffer));

            address = result.Item1;
            return(result.Item2);
        }
コード例 #2
0
 //
 // Sends a data buffer to a connected socket with up to size bytes
 //
 public int SendTo(IEnumerable <ArraySegment <byte> > buffer, SocketAddress endpoint) =>
 TaskToSync.Run(() => SendToAsync(buffer, endpoint));
コード例 #3
0
 //
 // Sends a data buffer to a connected socket with up to size bytes
 //
 public int Send(IEnumerable <ArraySegment <byte> > buffer) =>
 TaskToSync.Run(() => SendAsync(buffer));
コード例 #4
0
 //
 // Sync send a data buffer to a connected socket with up to size bytes
 //
 public int Send(ArraySegment <byte> buffer) =>
 TaskToSync.Run(() => SendAsync(buffer));
コード例 #5
0
 //
 // Same, but sync
 //
 public Socket Accept() => TaskToSync.Run(AcceptAsync);
コード例 #6
0
 //
 // Same, but sync
 //
 public void Listen(int backlog = int.MaxValue) =>
 TaskToSync.Run(() => ListenAsync(backlog));
コード例 #7
0
 //
 // Bind, sync
 //
 public void Bind(SocketAddress endpoint) =>
 TaskToSync.Run(() => BindAsync(endpoint));
コード例 #8
0
 //
 // Sync connect
 //
 public void Connect(SocketAddress endpoint) =>
 TaskToSync.Run(() => ConnectAsync(endpoint));
コード例 #9
0
 //
 // Receive into list of buffers
 //
 public int Receive(IEnumerable <ArraySegment <byte> > buffers) =>
 TaskToSync.Run(() => ReceiveAsync(buffers));
コード例 #10
0
 //
 // Sync close
 //
 public void Close() =>
 TaskToSync.Run(() => CloseAsync());
コード例 #11
0
 //
 // Receives data from a connected socket
 //
 public int Receive(ArraySegment <byte> buffer) =>
 TaskToSync.Run(() => ReceiveAsync(buffer));
コード例 #12
0
 //
 // Helper to get the value of a socket option.
 //
 public ulong GetSocketOption(SocketOption option) =>
 TaskToSync.Run(() => GetSocketOptionAsync(option));
コード例 #13
0
 //
 // Sets the specified option to the specified value.
 //
 public void SetSocketOption(SocketOption option, ulong value) =>
 TaskToSync.Run(() => SetSocketOptionAsync(option, value));
コード例 #14
0
 //
 // Same, but sync
 //
 public Socket Accept() =>
 TaskToSync.Run(() => AcceptAsync());
コード例 #15
0
 //
 // Sync version of GetHostEntry
 //
 public static DnsHostEntry GetHostEntry(SocketAddress address) =>
 TaskToSync.Run(() => GetHostEntryAsync(address));
コード例 #16
0
 //
 // Sync version of GetHostEntry
 //
 public static DnsHostEntry GetHostEntry(string hostName) =>
 TaskToSync.Run(() => GetHostEntryAsync(hostName));