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