System.Net.Sockets.TcpListener.BeginAcceptTcpClient C# (CSharp) Méthode

BeginAcceptTcpClient() public méthode

public BeginAcceptTcpClient ( AsyncCallback callback, object state ) : IAsyncResult
callback AsyncCallback
state object
Résultat IAsyncResult
        public IAsyncResult BeginAcceptTcpClient(AsyncCallback callback, object state)
        {
            if (NetEventSource.IsEnabled) NetEventSource.Enter(this);

            if (!_active)
            {
                throw new InvalidOperationException(SR.net_stopped);
            }

            IAsyncResult result = _serverSocket.BeginAccept(callback, state);
            if (NetEventSource.IsEnabled) NetEventSource.Exit(this, result);
            return result;
        }

Usage Example

 public void initializeListener()
 {
     listener = new TcpListener(new IPEndPoint(IPAddress.Any, Multiplayer.PORT));
     listener.AllowNatTraversal(true);
     listener.Start();
     listener.BeginAcceptTcpClient(AcceptTcpConnectionCallback, listener);
 }
All Usage Examples Of System.Net.Sockets.TcpListener::BeginAcceptTcpClient