|
ProtonNet Server 1.0
An Open Solution for all your socket or web api needs.
|
Represents a UDP server that provides functionalities for managing UDP connections and data transmission. More...
Public Member Functions | |
| UdpServer (string address, int port, UdpServerOptions options) | |
| Initializes a new instance of the UdpServer class with the specified address, port, and options. | |
| virtual bool | Start (string multicastAddress, int multicastPort) |
| Starts the UDP server with the specified multicast address and port. | |
| virtual bool | Start () |
| Starts the UDP server. | |
| virtual bool | Stop () |
| Stops the UDP server. | |
| virtual bool | Restart () |
| Restarts the UDP server. | |
| virtual bool | BroadcastAll (byte[] buffer) |
| Broadcasts a message to all clients using the specified buffer. | |
| virtual bool | BroadcastAll (byte[] buffer, int position, int length) |
| Broadcasts a message to all clients using the specified buffer, position, and length. | |
| virtual bool | BroadcastAllAsync (byte[] buffer) |
| Broadcasts a message asynchronously to all clients using the specified buffer. | |
| virtual bool | BroadcastAllAsync (byte[] buffer, int position, int length) |
| Broadcasts a message asynchronously to all clients using the specified buffer, position, and length. | |
| virtual bool | DisconnectAll () |
| Disconnects all connected sessions. | |
| IServerNetworkStatistics | GetNetworkStatistics () |
| Retrieves the server's network statistics. | |
| virtual bool | SendAsync (EndPoint endpoint, byte[] buffer) |
| Sends a datagram asynchronously to the specified endpoint using the provided buffer. | |
| virtual bool | SendAsync (EndPoint endpoint, byte[] buffer, int position, int length) |
| Sends a datagram asynchronously to the specified endpoint using the provided buffer, position, and length. | |
| virtual int | Send (EndPoint endpoint, byte[] buffer) |
| Sends a datagram synchronously to the specified endpoint using the provided buffer. | |
| virtual int | Send (EndPoint endpoint, byte[] buffer, int position, int length) |
| Sends a datagram synchronously to the specified endpoint using the provided buffer, position, and length. | |
| UdpSession | GetSession (string id) |
| Finds a session by its unique identifier. | |
| UdpSession | GetSession (EndPoint endpoint) |
| Finds a session by its remote endpoint. | |
| void | Dispose () |
| Releases the unmanaged resources used by the UdpServer and optionally releases the managed resources. | |
Public Member Functions inherited from XmobiTea.ProtonNetServer.IUdpServer | |
Public Member Functions inherited from XmobiTea.ProtonNetServer.IServer | |
Protected Member Functions | |
| virtual string | CreateRandomId () |
| Generates a random identifier string. | |
| virtual UdpSession | CreateSession () |
| Creates a new instance of the UdpSession class. | |
| virtual void | OnStarting () |
| Called when the server is starting. | |
| virtual void | OnStarted () |
| Called when the server has started. | |
| virtual void | OnStopping () |
| Called when the server is stopping. | |
| virtual void | OnStopped () |
| Called when the server has stopped. | |
| virtual void | OnConnecting (UdpSession session) |
| Called when a session is connecting. | |
| virtual void | OnConnected (UdpSession session) |
| Called when a session has connected. | |
| virtual void | OnDisconnecting (UdpSession session) |
| Called when a session is disconnecting. | |
| virtual void | OnDisconnected (UdpSession session) |
| Called when a session has disconnected. | |
| virtual void | OnReceived (EndPoint endpoint, byte[] buffer, int position, int length) |
| Called when data is received from a remote endpoint. | |
| virtual void | OnSent (EndPoint endpoint, int sent) |
| Called when data has been sent to a remote endpoint. | |
| virtual void | OnError (SocketError error) |
| Called when an error occurs during a socket operation. | |
| virtual void | Dispose (bool disposingManagedResources) |
| Releases the unmanaged resources used by the UdpServer and optionally releases the managed resources. | |
Properties | |
| string | Id [get] |
| Gets the unique identifier of the server. | |
| string | Address [get] |
| Gets the IP address of the server. | |
| int | Port [get] |
| Gets the port number on which the server is listening. | |
| EndPoint | EndPoint [get] |
| Gets the server's local endpoint. | |
| EndPoint | MulticastEndpoint [get] |
| Gets the multicast endpoint used by the server. | |
| ConcurrentDictionary< string, UdpSession > | Sessions [get] |
| Gets the collection of active UDP sessions. | |
| ConcurrentDictionary< System.Net.EndPoint, UdpSession > | EndPointWithSocketSessionDict [get] |
| Gets the dictionary that maps endpoints to UDP sessions. | |
| int | ConnectedSessions [get] |
| Gets the number of connected sessions. | |
| UdpServerOptions | Options [get] |
| Gets the options used by the UDP server. | |
| bool | IsStarted [get] |
| Gets a value indicating whether the server has been started. | |
| bool | IsDisposed [get] |
| Gets a value indicating whether the server has been disposed. | |
| bool | IsSocketDisposed [get] |
| Gets a value indicating whether the server's socket has been disposed. | |
Represents a UDP server that provides functionalities for managing UDP connections and data transmission.
| XmobiTea.ProtonNetServer.UdpServer.UdpServer | ( | string | address, |
| int | port, | ||
| UdpServerOptions | options ) |
Initializes a new instance of the UdpServer class with the specified address, port, and options.
| address | The IP address of the server. |
| port | The port number on which the server listens. |
| options | The options used by the server. |
|
virtual |
Broadcasts a message to all clients using the specified buffer.
| buffer | The data buffer to broadcast. |
Implements XmobiTea.ProtonNetServer.IServer.
|
virtual |
Broadcasts a message to all clients using the specified buffer, position, and length.
| buffer | The data buffer to broadcast. |
| position | The starting position in the buffer. |
| length | The length of the data to send. |
Implements XmobiTea.ProtonNetServer.IServer.
|
virtual |
Broadcasts a message asynchronously to all clients using the specified buffer.
| buffer | The data buffer to broadcast. |
Implements XmobiTea.ProtonNetServer.IServer.
|
virtual |
Broadcasts a message asynchronously to all clients using the specified buffer, position, and length.
| buffer | The data buffer to broadcast. |
| position | The starting position in the buffer. |
| length | The length of the data to send. |
Implements XmobiTea.ProtonNetServer.IServer.
|
protectedvirtual |
Generates a random identifier string.
|
protectedvirtual |
Creates a new instance of the UdpSession class.
Reimplemented in XmobiTea.ProtonNet.Server.Socket.Server.SocketUdpServer.
|
virtual |
Disconnects all connected sessions.
Implements XmobiTea.ProtonNetServer.IServer.
|
protectedvirtual |
Releases the unmanaged resources used by the UdpServer and optionally releases the managed resources.
| disposingManagedResources | True to release both managed and unmanaged resources; false to release only unmanaged resources. |
| IServerNetworkStatistics XmobiTea.ProtonNetServer.UdpServer.GetNetworkStatistics | ( | ) |
Retrieves the server's network statistics.
Implements XmobiTea.ProtonNetServer.IServer.
| UdpSession XmobiTea.ProtonNetServer.UdpServer.GetSession | ( | EndPoint | endpoint | ) |
Finds a session by its remote endpoint.
| endpoint | The remote endpoint. |
| UdpSession XmobiTea.ProtonNetServer.UdpServer.GetSession | ( | string | id | ) |
Finds a session by its unique identifier.
| id | The session identifier. |
|
protectedvirtual |
Called when a session has connected.
| session | The session that has connected. |
|
protectedvirtual |
Called when a session is connecting.
| session | The session that is connecting. |
|
protectedvirtual |
Called when a session has disconnected.
| session | The session that has disconnected. |
|
protectedvirtual |
Called when a session is disconnecting.
| session | The session that is disconnecting. |
|
protectedvirtual |
Called when an error occurs during a socket operation.
| error | The socket error that occurred. |
|
protectedvirtual |
Called when data is received from a remote endpoint.
| endpoint | The remote endpoint. |
| buffer | The data buffer containing the received data. |
| position | The starting position in the buffer. |
| length | The length of the received data. |
|
protectedvirtual |
Called when data has been sent to a remote endpoint.
| endpoint | The remote endpoint. |
| sent | The number of bytes sent. |
|
virtual |
Restarts the UDP server.
Implements XmobiTea.ProtonNetServer.IServer.
|
virtual |
Sends a datagram synchronously to the specified endpoint using the provided buffer.
| endpoint | The destination endpoint. |
| buffer | The data buffer to send. |
Implements XmobiTea.ProtonNetServer.IUdpServer.
|
virtual |
Sends a datagram synchronously to the specified endpoint using the provided buffer, position, and length.
| endpoint | The destination endpoint. |
| buffer | The data buffer to send. |
| position | The starting position in the buffer. |
| length | The length of the data to send. |
Implements XmobiTea.ProtonNetServer.IUdpServer.
|
virtual |
Sends a datagram asynchronously to the specified endpoint using the provided buffer.
| endpoint | The destination endpoint. |
| buffer | The data buffer to send. |
Implements XmobiTea.ProtonNetServer.IUdpServer.
|
virtual |
Sends a datagram asynchronously to the specified endpoint using the provided buffer, position, and length.
| endpoint | The destination endpoint. |
| buffer | The data buffer to send. |
| position | The starting position in the buffer. |
| length | The length of the data to send. |
Implements XmobiTea.ProtonNetServer.IUdpServer.
|
virtual |
Starts the UDP server.
Implements XmobiTea.ProtonNetServer.IServer.
|
virtual |
Starts the UDP server with the specified multicast address and port.
| multicastAddress | The multicast address to join. |
| multicastPort | The multicast port to use. |
Implements XmobiTea.ProtonNetServer.IUdpServer.
|
virtual |
Stops the UDP server.
Implements XmobiTea.ProtonNetServer.IServer.