Interface INetworkClient
The network client interface.
Namespace: Evergine.Networking.Connection
Assembly: Evergine.Networking.dll
Syntax
public interface INetworkClient
Properties
Identifier
Gets the identifier.
Declaration
long Identifier { get; }
Property Value
Type | Description |
---|---|
long | The identifier. |
IsConnected
Gets a value indicating whether this instance is connected.
Declaration
bool IsConnected { get; }
Property Value
Type | Description |
---|---|
bool |
|
Methods
Connect(NetworkEndpoint)
Connects to a remote host.
Declaration
void Connect(NetworkEndpoint host)
Parameters
Type | Name | Description |
---|---|---|
NetworkEndpoint | host | The remote host's endpoint to connect to. |
Connect(NetworkEndpoint, OutgoingMessage)
Connects to a remote host.
Declaration
void Connect(NetworkEndpoint host, OutgoingMessage hailMessage)
Parameters
Type | Name | Description |
---|---|---|
NetworkEndpoint | host | The remote host endpoint to connect to. |
OutgoingMessage | hailMessage | The greeting message to send. |
CreateMessage(MessageType)
Creates a new outgoing message.
Declaration
OutgoingMessage CreateMessage(MessageType type = MessageType.Data)
Parameters
Type | Name | Description |
---|---|---|
MessageType | type | The message type. |
Returns
Type | Description |
---|---|
OutgoingMessage | The created outgoing message. |
Disconnect()
Disconnects from the server.
Declaration
void Disconnect()
DiscoverHosts(int)
Emits a discovery signal to all hosts on your subnet. Hosts with the same appId and port will be notified by the HostDisconnected event.
Declaration
void DiscoverHosts(int port)
Parameters
Type | Name | Description |
---|---|---|
int | port | The expected port. |
Send(OutgoingMessage, DeliveryMethod)
Sends the specified message to the host.
Declaration
void Send(OutgoingMessage toSendMessage, DeliveryMethod deliveryMethod)
Parameters
Type | Name | Description |
---|---|---|
OutgoingMessage | toSendMessage | The message to send. |
DeliveryMethod | deliveryMethod | The delivery method. |
Events
HostConnected
Occurs when the client connects to a host.
Declaration
event EventHandler<HostConnectedEventArgs> HostConnected
Event Type
Type | Description |
---|---|
EventHandler<HostConnectedEventArgs> |
HostDisconnected
Occurs when the client disconnects from the host.
Declaration
event EventHandler<HostDisconnectedEventArgs> HostDisconnected
Event Type
Type | Description |
---|---|
EventHandler<HostDisconnectedEventArgs> |
HostDiscovered
Occurs when a new host with the same application identifier is discovered.
Declaration
event EventHandler<HostDiscoveredEventArgs> HostDiscovered
Event Type
Type | Description |
---|---|
EventHandler<HostDiscoveredEventArgs> |
MessageReceived
Occurs when a host message is received from the client.
Declaration
event EventHandler<MessageReceivedEventArgs> MessageReceived
Event Type
Type | Description |
---|---|
EventHandler<MessageReceivedEventArgs> |