// // 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); }
// // 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));
// // Sends a data buffer to a connected socket with up to size bytes // public int Send(IEnumerable <ArraySegment <byte> > buffer) => TaskToSync.Run(() => SendAsync(buffer));
// // Sync send a data buffer to a connected socket with up to size bytes // public int Send(ArraySegment <byte> buffer) => TaskToSync.Run(() => SendAsync(buffer));
// // Same, but sync // public Socket Accept() => TaskToSync.Run(AcceptAsync);
// // Same, but sync // public void Listen(int backlog = int.MaxValue) => TaskToSync.Run(() => ListenAsync(backlog));
// // Bind, sync // public void Bind(SocketAddress endpoint) => TaskToSync.Run(() => BindAsync(endpoint));
// // Sync connect // public void Connect(SocketAddress endpoint) => TaskToSync.Run(() => ConnectAsync(endpoint));
// // Receive into list of buffers // public int Receive(IEnumerable <ArraySegment <byte> > buffers) => TaskToSync.Run(() => ReceiveAsync(buffers));
// // Sync close // public void Close() => TaskToSync.Run(() => CloseAsync());
// // Receives data from a connected socket // public int Receive(ArraySegment <byte> buffer) => TaskToSync.Run(() => ReceiveAsync(buffer));
// // Helper to get the value of a socket option. // public ulong GetSocketOption(SocketOption option) => TaskToSync.Run(() => GetSocketOptionAsync(option));
// // Sets the specified option to the specified value. // public void SetSocketOption(SocketOption option, ulong value) => TaskToSync.Run(() => SetSocketOptionAsync(option, value));
// // Same, but sync // public Socket Accept() => TaskToSync.Run(() => AcceptAsync());
// // Sync version of GetHostEntry // public static DnsHostEntry GetHostEntry(SocketAddress address) => TaskToSync.Run(() => GetHostEntryAsync(address));
// // Sync version of GetHostEntry // public static DnsHostEntry GetHostEntry(string hostName) => TaskToSync.Run(() => GetHostEntryAsync(hostName));