Client: Client
Isolated
Initializes the UDP connectionless client based on the provided configurations.
Constructor
Initializes the UDP connectionless client based on the provided configurations.
1udp:Client|udp:Error? socketClient = new(localHost = "localhost");
init (*ClientConfiguration config)
- config *ClientConfiguration
Connectionless client-related configuration
Remote Methods
sendDatagram | Sends the given data to the specified remote host. |
receiveDatagram | Reads data from the remote host. |
close | Free up the occupied socket. |
sendDatagram
Isolated Function
Remote Function
Sends the given data to the specified remote host.
1udp:Error? result = socketClient->sendDatagram({remoteHost: "localhost",2 remotePort: 48826, data:"msg".toBytes()});
Parameters
- datagram Datagram
Contains the data to be sent to the remote host and the address of the remote host
receiveDatagram
Isolated Function
Remote Function
Reads data from the remote host.
1udp:Datagram|udp:Error result = socketClient->receiveDatagram();