Method Connect
Connect(NetworkEndpoint)
Establish a new connection to the given endpoint. Note that this only starts establishing the new connection. From there it will either succeeds (a Connect event will pop on the connection) or fail (a Disconnect event will pop on the connection) at a later time.
Declaration
public NetworkConnection Connect(NetworkEndpoint endpoint)
Parameters
Type | Name | Description |
---|---|---|
NetworkEndpoint | endpoint | Endpoint to connect to. |
Returns
Type | Description |
---|---|
NetworkConnection | New connection object, or a default-valued object on failure. |
Remarks
Establishing a new connection normally requires the driver to be bound (e.g. with the
Bind(NetworkEndpoint) method), but if that's not the case when calling this method, the
driver will be implicitly bound to the appropriate wildcard address. This is a behavior
similar to BSD sockets, where calling connect
automatically binds the socket to
an ephemeral port.