Photon Fusion 2.0.3

Public Member Functions | Properties | List of all members
INetSocket Interface Reference

Defines the interface for network socket operations. More...

Public Member Functions

NetAddress Bind (NetSocket socket, NetConfig config)
 Binds the socket to the specified address and configuration. More...
 
bool CanFragment (NetAddress address)
 Determines whether the specified address can be fragmented. More...
 
NetSocket Create (NetConfig config)
 Creates a new socket with the specified configuration. More...
 
void DeleteEncryptionKey (NetAddress address)
 Deletes the encryption key for the specified address. More...
 
void Destroy (NetSocket socket)
 Destroys the specified socket. More...
 
void Initialize (NetConfig config)
 Initializes the socket with the specified configuration. More...
 
bool Poll (NetSocket socket, long timeout)
 Polls the socket for incoming data with the specified timeout. More...
 
int Receive (NetSocket socket, NetAddress *address, byte *buffer, int bufferLength)
 Receives data from the socket into the specified buffer. More...
 
int Send (NetSocket socket, NetAddress *address, byte *buffer, int bufferLength, bool reliable=false)
 Sends data from the specified buffer to the socket. More...
 
void SetupEncryption (byte[] key, byte[] encryptedKey)
 Sets up encryption with the specified key and encrypted key. More...
 

Properties

bool SupportsMultiThreading [get]
 Gets a value indicating whether the socket supports multi-threading. More...
 

Detailed Description

Defines the interface for network socket operations.

Member Function Documentation

◆ Bind()

NetAddress Bind ( NetSocket  socket,
NetConfig  config 
)

Binds the socket to the specified address and configuration.

Parameters
socketThe socket to bind.
configThe configuration for the socket.
Returns
The bound address.

◆ CanFragment()

bool CanFragment ( NetAddress  address)

Determines whether the specified address can be fragmented.

Parameters
addressThe address to check.
Returns
True if the address can be fragmented, otherwise false.

◆ Create()

NetSocket Create ( NetConfig  config)

Creates a new socket with the specified configuration.

Parameters
configThe configuration for the socket.
Returns
The created socket.

◆ DeleteEncryptionKey()

void DeleteEncryptionKey ( NetAddress  address)

Deletes the encryption key for the specified address.

Parameters
addressThe address to delete the encryption key for.

◆ Destroy()

void Destroy ( NetSocket  socket)

Destroys the specified socket.

Parameters
socketThe socket to destroy.

◆ Initialize()

void Initialize ( NetConfig  config)

Initializes the socket with the specified configuration.

Parameters
configThe configuration for the socket.

◆ Poll()

bool Poll ( NetSocket  socket,
long  timeout 
)

Polls the socket for incoming data with the specified timeout.

Parameters
socketThe socket to poll.
timeoutThe timeout in milliseconds.
Returns
True if data is available, otherwise false.

◆ Receive()

int Receive ( NetSocket  socket,
NetAddress address,
byte *  buffer,
int  bufferLength 
)

Receives data from the socket into the specified buffer.

Parameters
socketThe socket to receive data from.
addressThe address of the sender.
bufferThe buffer to store the received data.
bufferLengthThe length of the buffer.
Returns
The number of bytes received.

◆ Send()

int Send ( NetSocket  socket,
NetAddress address,
byte *  buffer,
int  bufferLength,
bool  reliable = false 
)

Sends data from the specified buffer to the socket.

Parameters
socketThe socket to send data to.
addressThe address of the recipient.
bufferThe buffer containing the data to send.
bufferLengthThe length of the buffer.
reliableSend reliable or not
Returns
The number of bytes sent.

◆ SetupEncryption()

void SetupEncryption ( byte[]  key,
byte[]  encryptedKey 
)

Sets up encryption with the specified key and encrypted key.

Parameters
keyThe encryption key.
encryptedKeyThe encrypted key.

Property Documentation

◆ SupportsMultiThreading

bool SupportsMultiThreading
get

Gets a value indicating whether the socket supports multi-threading.