Accept Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Creates a new Socket for a newly created connection.

Namespace:  System.Net.Sockets
Assembly:  System (in System.dll)

Syntax

'Declaration
Public Function Accept As Socket
public Socket Accept()
public:
Socket^ Accept()
member Accept : unit -> Socket 
public function Accept() : Socket

Return Value

Type: System.Net.Sockets. . :: . .Socket
A Socket for a newly created connection.

Remarks

Accept synchronously extracts the first pending connection request from the connection request queue of the listening socket, and then creates and returns a new Socket. You cannot use this returned Socket to accept any additional connections from the connection queue. However, you can call the RemoteEndPoint method of the returned Socket to identify the remote host's network address and port number.

Note

Before calling the Accept method, you must first call the Listen method to listen for and queue incoming connection requests.

.NET Framework Security

See Also

Reference

Socket Class

System.Net.Sockets Namespace