Ejemplo n.º 1
0
        public CClientSocket(Socket socket)
        {
            m_socket = socket;

            Host     = CSockHelp.SetSockOpt(ref m_socket);
            Disposed = false;

            m_recvBuffer = new byte[ReceiveSize];
            m_buffer     = new byte[ReceiveSize];
            m_offset     = 0;

            m_sendSync = new object();
        }
Ejemplo n.º 2
0
        public void StartListen(int backlog = 0)
        {
            ThrowIfDisposed();

            if (m_active)
            {
                throw new InvalidOperationException();
            }

            m_sock = CSockHelp.CreateTcpSock();
            m_sock.Bind(new IPEndPoint(m_address, m_port));
            m_sock.Listen(backlog);

            m_active = true;

            BeginAccept();
        }