public void StartListen(int backlog = 100) { //backlog default 2147483647 ThrowIfDisposed(); ThrowIfBadPort(); if (m_active) { throw new InvalidOperationException(); } m_sock = SocketEx.CreateTcpSock(); //m_sock.DualMode = DualMode; m_sock.ExclusiveAddressUse = ExclusiveAddress; m_sock.Bind(new IPEndPoint(m_address, m_port)); m_active = true; try { m_sock.Listen(backlog); } catch (SocketException) { StopListen(); throw; } BeginAccept(); //Maple does 10 }
public CSocketBase(Socket socket) { m_socket = socket; Host = SocketEx.SetSockOpt(ref m_socket); Disposed = false; m_buffer = new byte[ReceiveSize]; m_offset = 0; m_sendSync = new object(); }
public void StartListen(int nBackLog = 10) { var endpoint = new IPEndPoint(Address, Port); Socket = SocketEx.CreateTcpSock(); Socket.Bind(endpoint); Socket.Listen(nBackLog); Thread = new Thread(BeginAccept); Thread.Name = $"SockAcceptorEx-{Port}"; Thread.IsBackground = true; Thread.Priority = ThreadPriority.AboveNormal; Thread.Start(); }
public void Create() { var sock = SocketEx.CreateTcpSock(); var iar = sock.BeginConnect(Host, Port, EndConnect, sock); }