Ejemplo n.º 1
0
		/// <summary>
		/// Accepts a pending connection
		/// </summary>
		/// <returns>A TcpClient
		/// object made from the new socket.</returns>
		public TcpClient AcceptTcpClient ()
		{
			if (!active)
				throw new InvalidOperationException ("Socket is not listening");

			Socket clientSocket = server.Accept ();

			TcpClient client = new TcpClient();
			// use internal method SetTcpClient to make a
			// client with the specified socket
			client.SetTcpClient (clientSocket);
			
			return client;
		}
Ejemplo n.º 2
0
		public TcpClient EndAcceptTcpClient (IAsyncResult asyncResult)
		{
			Socket clientSocket = server.EndAccept (asyncResult);
			TcpClient client = new TcpClient ();
			
			client.SetTcpClient (clientSocket);
			
			return(client);
		}
Ejemplo n.º 3
0
 public TcpClient AcceptTcpClient()
 {
     if (!this.active)
     {
         throw new InvalidOperationException("Socket is not listening");
     }
     Socket s = this.server.Accept();
     TcpClient client = new TcpClient();
     client.SetTcpClient(s);
     return client;
 }