Method Bind
Bind(NetworkEndpoint)
Bind the driver to an endpoint. This endpoint would normally be a local IP address and port which the driver will use for its communications. Binding to a wildcard address (AnyIpv4 or AnyIpv6) will result in the driver using any local address for its communications, and binding to port 0 will result in the driver using an ephemeral free port chosen by the OS.
Declaration
public int Bind(NetworkEndpoint endpoint)
Parameters
Type | Name | Description |
---|---|---|
NetworkEndpoint | endpoint | Endpoint to bind to. |
Returns
Type | Description |
---|---|
int | 0 on success, negative error code on error. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the driver is not created properly, if it's already bound, or if there are already connections made to the driver (although that shouldn't be possible). Note that these exceptions are only thrown if safety checks are enabled (i.e. in the editor). |