public SnowTcpListener(IPEndPoint LocalEndpoint, int Backlog, OnNewConnectionCallback Callback) { mCallback = Callback; mSocket = new Socket(LocalEndpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); mSocket.Bind(LocalEndpoint); mSocket.Listen(Backlog); BeginAccept(); }
public TrioUdpListener(IPEndPoint LocalEndpoint, int Backlog, OnNewConnectionCallback Callback) { mCallback = Callback; mSocket = new Socket(LocalEndpoint.AddressFamily, SocketType.Dgram, ProtocolType.Udp); mSocket.Bind(LocalEndpoint); mSocket.Listen(Backlog); mSocket.Blocking = false; BeginAccept(); }
public SocketListener(IPEndPoint LocalEndpoint, int Backlog, OnNewConnectionCallback Callback) { mCallback = Callback; mSocket = new Socket(LocalEndpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { mSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1); } mSocket.Bind(LocalEndpoint); mSocket.Listen(Backlog); mSocket.Blocking = false; BeginAccept(); }