|
ProtonNet Server 1.0
An Open Solution for all your socket or web api needs.
|
Implements a UDP client for sending and receiving data over a network. Provides both synchronous and asynchronous operations. More...
Public Member Functions | |
| UdpClient (string address, int port, UdpClientOptions options) | |
| Initializes a new instance of the UdpClient class. | |
| INetworkStatistics | GetNetworkStatistics () |
| Gets the network statistics associated with the client. | |
| virtual bool | Connect () |
| Connects the client to the server synchronously. | |
| virtual bool | Disconnect () |
| Disconnects the client from the server synchronously. | |
| virtual bool | Reconnect () |
| Reconnects the client to the server by first disconnecting and then reconnecting. | |
| virtual bool | ConnectAsync () |
| Connects the client to the server asynchronously. | |
| virtual bool | DisconnectAsync () |
| Disconnects the client from the server asynchronously. | |
| virtual bool | ReconnectAsync () |
| Reconnects the client to the server asynchronously by first disconnecting and then reconnecting. | |
| virtual void | JoinMulticastGroup (string address) |
| Joins a multicast group by the specified address. | |
| virtual void | LeaveMulticastGroup (string address) |
| Leaves a multicast group by the specified address. | |
| virtual int | Send (byte[] buffer) |
| Sends data to the server synchronously. | |
| virtual int | Send (byte[] buffer, int position, int length) |
| Sends data to the server synchronously starting from a specific position in the buffer. | |
| virtual int | Send (EndPoint endPoint, byte[] buffer) |
| Sends data to the specified endpoint synchronously. | |
| virtual int | Send (EndPoint endPoint, byte[] buffer, int position, int length) |
| Sends data to the specified endpoint synchronously, starting from a specific position in the buffer. | |
| virtual bool | SendAsync (byte[] buffer) |
| Sends data to the server asynchronously. | |
| virtual bool | SendAsync (byte[] buffer, int position, int length) |
| Sends data to the server asynchronously starting from a specific position in the buffer. | |
| virtual bool | SendAsync (EndPoint endPoint, byte[] buffer) |
| Sends data to the specified endpoint asynchronously. | |
| virtual bool | SendAsync (EndPoint endPoint, byte[] buffer, int position, int length) |
| Sends data to the specified endpoint asynchronously, starting from a specific position in the buffer. | |
| void | Dispose () |
| Disposes the UDP client, releasing all resources. | |
Public Member Functions inherited from XmobiTea.ProtonNetClient.IUdpClient | |
Public Member Functions inherited from XmobiTea.ProtonNetClient.IClient | |
Public Attributes | |
| EndPoint | EndPoint |
| Gets or sets the endpoint representing the server's address and port. | |
Protected Member Functions | |
| virtual void | OnConnecting () |
| Called when the client is in the process of connecting. Can be overridden in derived classes to handle the event. | |
| virtual void | OnConnected () |
| Called when the client has successfully connected to the server. Can be overridden in derived classes to handle the event. | |
| virtual void | OnDisconnecting () |
| Called when the client is in the process of disconnecting. Can be overridden in derived classes to handle the event. | |
| virtual void | OnDisconnected () |
| Called when the client has successfully disconnected from the server. Can be overridden in derived classes to handle the event. | |
| virtual void | OnJoinedMulticastGroup (string address) |
| Called when the client successfully joins a multicast group. Can be overridden in derived classes to handle the event. | |
| virtual void | OnLeftMulticastGroup (string address) |
| Called when the client successfully leaves a multicast group. Can be overridden in derived classes to handle the event. | |
| virtual void | OnReceived (EndPoint endPoint, byte[] buffer, int position, int length) |
| Called when data is received from the server. Can be overridden in derived classes to handle the event. | |
| virtual void | OnSent (EndPoint endPoint, int sent) |
| Called when data is successfully sent to the server. Can be overridden in derived classes to handle the event. | |
| virtual void | OnEmpty () |
| Called when the send buffer is empty. Can be overridden in derived classes to handle the event. | |
| virtual void | OnError (SocketError error) |
| Called when an error occurs during socket operations. Can be overridden in derived classes to handle the event. | |
| virtual void | Dispose (bool disposingManagedResources) |
| Disposes the UDP client, releasing managed resources if specified. | |
Properties | |
| string | Id [get] |
| Gets the unique identifier for this UDP client instance. | |
| string | Address [get] |
| Gets the server address to which the client is connected. | |
| int | Port [get] |
| Gets the port number on the server to which the client is connected. | |
| Socket | Socket [get] |
| Gets the underlying socket used for the connection. | |
| UdpClientOptions | Options [get] |
| Gets the options used to configure the UDP client. | |
| bool | IsConnecting [get] |
| Gets a value indicating whether the client is currently connecting. | |
| bool | IsConnected [get] |
| Gets a value indicating whether the client is connected to the server. | |
| bool | IsDisposed [get] |
| Gets a value indicating whether the client has been disposed. | |
| bool | IsSocketDisposed = true [get] |
| Gets a value indicating whether the socket has been disposed. | |
Implements a UDP client for sending and receiving data over a network. Provides both synchronous and asynchronous operations.
| XmobiTea.ProtonNetClient.UdpClient.UdpClient | ( | string | address, |
| int | port, | ||
| UdpClientOptions | options ) |
Initializes a new instance of the UdpClient class.
| address | The server address to connect to. |
| port | The port number on the server. |
| options | UDP client options for configuring the connection. |
|
virtual |
Connects the client to the server synchronously.
Implements XmobiTea.ProtonNetClient.IClient.
Reimplemented in XmobiTea.ProtonNet.Client.Socket.Clients.SocketUdpClient.
|
virtual |
Connects the client to the server asynchronously.
Implements XmobiTea.ProtonNetClient.IClient.
|
virtual |
Disconnects the client from the server synchronously.
Implements XmobiTea.ProtonNetClient.IClient.
Reimplemented in XmobiTea.ProtonNet.Client.Socket.Clients.SocketUdpClient.
|
virtual |
Disconnects the client from the server asynchronously.
Implements XmobiTea.ProtonNetClient.IClient.
|
protectedvirtual |
Disposes the UDP client, releasing managed resources if specified.
| disposingManagedResources | True to release managed resources; otherwise, false. |
| INetworkStatistics XmobiTea.ProtonNetClient.UdpClient.GetNetworkStatistics | ( | ) |
Gets the network statistics associated with the client.
Implements XmobiTea.ProtonNetClient.IClient.
|
virtual |
Joins a multicast group by the specified address.
| address | The address of the multicast group. |
Implements XmobiTea.ProtonNetClient.IUdpClient.
|
virtual |
Leaves a multicast group by the specified address.
| address | The address of the multicast group. |
Implements XmobiTea.ProtonNetClient.IUdpClient.
|
protectedvirtual |
Called when the client has successfully connected to the server. Can be overridden in derived classes to handle the event.
Reimplemented in XmobiTea.ProtonNet.Client.Socket.Clients.SocketUdpClient.
|
protectedvirtual |
Called when the client has successfully disconnected from the server. Can be overridden in derived classes to handle the event.
Reimplemented in XmobiTea.ProtonNet.Client.Socket.Clients.SocketUdpClient.
|
protectedvirtual |
Called when an error occurs during socket operations. Can be overridden in derived classes to handle the event.
| error | The socket error that occurred. |
|
protectedvirtual |
Called when the client successfully joins a multicast group. Can be overridden in derived classes to handle the event.
| address | The address of the multicast group. |
|
protectedvirtual |
Called when the client successfully leaves a multicast group. Can be overridden in derived classes to handle the event.
| address | The address of the multicast group. |
|
protectedvirtual |
Called when data is received from the server. Can be overridden in derived classes to handle the event.
| endPoint | The endpoint from which the data is received. |
| buffer | The buffer containing the received data. |
| position | The starting position in the buffer. |
| length | The length of the received data. |
Reimplemented in XmobiTea.ProtonNet.Client.Socket.Clients.SocketUdpClient.
|
protectedvirtual |
Called when data is successfully sent to the server. Can be overridden in derived classes to handle the event.
| endPoint | The endpoint to which the data was sent. |
| sent | The number of bytes sent. |
|
virtual |
Reconnects the client to the server by first disconnecting and then reconnecting.
Implements XmobiTea.ProtonNetClient.IClient.
Reimplemented in XmobiTea.ProtonNet.Client.Socket.Clients.SocketUdpClient.
|
virtual |
Reconnects the client to the server asynchronously by first disconnecting and then reconnecting.
Implements XmobiTea.ProtonNetClient.IClient.
|
virtual |
Sends data to the server synchronously.
| buffer | The data to send. |
Implements XmobiTea.ProtonNetClient.IClient.
|
virtual |
Sends data to the server synchronously starting from a specific position in the buffer.
| buffer | The data to send. |
| position | The starting position in the buffer. |
| length | The number of bytes to send. |
Implements XmobiTea.ProtonNetClient.IClient.
|
virtual |
Sends data to the specified endpoint synchronously.
| endPoint | The endpoint to which the data is sent. |
| buffer | The data to send. |
Implements XmobiTea.ProtonNetClient.IUdpClient.
|
virtual |
Sends data to the specified endpoint synchronously, starting from a specific position in the buffer.
| endPoint | The endpoint to which the data is sent. |
| buffer | The data to send. |
| position | The starting position in the buffer. |
| length | The number of bytes to send. |
Implements XmobiTea.ProtonNetClient.IUdpClient.
|
virtual |
Sends data to the server asynchronously.
| buffer | The data to send. |
Implements XmobiTea.ProtonNetClient.IClient.
|
virtual |
Sends data to the server asynchronously starting from a specific position in the buffer.
| buffer | The data to send. |
| position | The starting position in the buffer. |
| length | The number of bytes to send. |
Implements XmobiTea.ProtonNetClient.IClient.
|
virtual |
Sends data to the specified endpoint asynchronously.
| endPoint | The endpoint to which the data is sent. |
| buffer | The data to send. |
Implements XmobiTea.ProtonNetClient.IUdpClient.
|
virtual |
Sends data to the specified endpoint asynchronously, starting from a specific position in the buffer.
| endPoint | The endpoint to which the data is sent. |
| buffer | The data to send. |
| position | The starting position in the buffer. |
| length | The number of bytes to send. |
Implements XmobiTea.ProtonNetClient.IUdpClient.