Mono Class Library: System.Net.Sockets.Socket Overview | MembersSystem.Net.Sockets.Socket.BeginConnect Method |
Begins an asynchronous operation to associate the current instance with a remote endpoint. [Edit]
|
- end_point
- Documentation for this section has not yet been entered. [Edit]
- callback
- A AsyncCallback delegate, or null. [Edit]
- state
- An application-defined object, or null. [Edit]
A IAsyncResult instance that contains information about the asynchronous operation. [Edit]
Type Reason System.Net.SocketPermission [Edit] Requires permission to make a connection to the endpoint defined by remoteEP. Note: See System.Net.NetworkAccess.Connect.
Type Reason ArgumentNullException remoteEP is null. [Edit] System.Net.Sockets.SocketException Note: For additional information on causes of the SocketException, see the System.Net.Sockets.SocketException class.[Edit]ObjectDisposedException The current instance has been disposed. [Edit] System.Security.SecurityException A caller higher in the call stack does not have permission for the requested operation. [Edit]
To release resources allocated by the Socket.BeginConnect(System.Net.EndPoint, AsyncCallback, object) method, call the Socket.EndConnect(IAsyncResult) method, and specify the IAsyncResult object returned by this method.
Note: The Socket.EndConnect(IAsyncResult) method should be called exactly once for each call to the Socket.BeginConnect(System.Net.EndPoint, AsyncCallback, object) method.If the callback parameter is not null, the method referenced by callback is invoked when the asynchronous operation completes. The IAsyncResult object returned by this method is passed as the argument to the method referenced by callback. The method referenced by callback can retrieve the results of the operation by calling the Socket.EndConnect(IAsyncResult) method.
The state parameter can be any object that the caller wishes to have available for the duration of the asynchronous operation. This object is available via the IAsyncResult.AsyncState property of the object returned by this method.
To determine the connection status, check the Socket.Connected property, or use either the Socket.Poll(int, SelectMode) or Socket.Select(IList, IList, IList, int) method.
Note:[Edit]For more information, see Socket.Connect(System.Net.EndPoint), the synchronous version of this method.
For an outline of an asynchronous operation, see the Socket.BeginAccept(AsyncCallback, object) method. For the complete example, which uses the Socket.BeginConnect(System.Net.EndPoint, AsyncCallback, object) method, see the System.Net.Sockets.Socket class overview.
Namespace: System.Net.Sockets
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0