Client: ConnectClient
Isolated
Initializes the UDP connection oriented client based on the provided configurations.
Constructor
Initializes the UDP connect client based on the provided configurations.
1udp:ConnectClient|udp:Error? socketClient = new("www.remote.com", 80,2 localHost = "localHost");
init (string remoteHost, int remotePort, *ConnectClientConfiguration config)
- remoteHost string
The hostname or the IP address of the remote host
- remotePort int
The port number of the remote host
- config *ConnectClientConfiguration
Connection oriented client related configuration
Remote Methods
writeBytes | Sends the given data to the connected remote host. |
readBytes | Reads data only from the connected remote host. |
close | Free up the occupied socket. |
writeBytes
function writeBytes(byte[ ] data) returns Error?
Isolated Function
Remote Function
Sends the given data to the connected remote host.
1udp:Error? result = socketClient->writeBytes("msg".toBytes());
Parameters
- data byte[ ]
The data need to be sent to the connected remote host
readBytes
function readBytes() returns (readonly & byte[ ]) | Error
Isolated Function
Remote Function
Reads data only from the connected remote host.
1readonly & byte[]|udp:Error result = socketClient->readBytes();
Return Type
((readonly & byte[ ]) | Error)A byte[]
or else a udp:Error
if the data
cannot be read from the remote host