Socket component is implementing a client socket. The socket can be of type TCP or type UDP.
The above code will construct a client socket of type TCP which will be connected to localhost port 1. If the connection was made it will wait until the server sends some text delimited by a line end and then sends back the base 64 encoded version of the message to the server. It will continue to do this until either the connection is reseted by the server or server send a message with the content "bye".
Sends the buffer specified in the data parameter on the socket. If the type of the socket is TCP sending data will fail if the socket is not connected. If while sending, the current timeout expires the function will return without sending all the data on the socket.
The function will return an integer representing the number of bytes actually sent. If the function returns 0, the send failed and last error properties are set.
Read all the available data from the socket.
The function will return the data received as string. Return value can be empty string if timeout has expired, no data was received or an error occured. In the later case last error properties are set.
Reads data from the socket until the given delimiter has been received or timeout has expired.
The function will return the data received as string without the delimiter. Return value can be empty string if timeout has expired or an error occured. In that cases last error properties are set.
Reads data from the socket until line terminator is received.
The function will return the data received as string without the line end. Return value can be empty string if timeout has expired or an error occured. In that cases last error properties are set.
Reads data from the socket until a given number of bytes has been received.
The function will return the data received as string. Return value can be empty string if timeout has expired or an error occured. In that cases last error properties are set.
Connects the socket to the remote host. For connectionless UDP protocol, by convention Connect must be called to receive the response.
The function will return true on success or false on failure in which case last error properties are set.
Closes the connection on the socket.
Read only property of type integer containing the error code for the last operation. Code 0 means no error.
Read only property of type string containing the error message for the last operation. Empty string means no error.
Read and write property of type string containing the remote host. This property must be set before calling Connect.
Read and write property of type integer containing the remote port. This property must be set before calling Connect.
Read only property of type boolean. This property is true if the socket is connected.
Read and write property of type float containing the timeout value in seconds of the read or write operations.