IEndPoint
Description
- Extended by
-
SocketEndPoint sealed
Base interface for classes that represent network addresses resp. endpoints.
A typical usage of network endpoints looks like this (A and B refer to the participants):
-
A chooses an unused IEndPoint and calls CreateServer to create a IServer object.
-
A calls IServer.Accept to accept an incoming connection and obtains a IConnection object.
-
B chooses a suitable IEndPoint, calls OpenConnection to connect to the server of A and receives a IConnection object.
-
A and B use the IConnection.Send and IConnection.Receive methods to transfer data.
A graceful shutdown of a network connection can be performed in the following way:
-
Either side calls IConnection.Close.
-
The other side receives
false
when calling IConnection.Receive.
A forceful shutdown of a network connection is performed like this:
-
Either side calls IConnection.Discard or A calls IDisposable.Dispose on its server.
-
The other side gets an IOException when calling IConnection.Send or IConnection.Receive.
Public / Methods
CreateServer
Creates a new network server that listens on this endpoint.
A system resource of a network endpoint may remain in an unusable state after the owning IServer object has been disposed (for example, TCP/IP connections enter the TIME_WAIT state after an active close). Client code must take that into account when creating servers on the same endpoint repeatedly, for example when running unit tests.
- IOException
-
If an I/O error has occurred.
OpenConnection
Opens a new network connection to this endpoint.
- IOException
-
If an I/O error has occurred.