class TCPSocketClient
- supers: TCPSocketMaster
😱 Types incomplete or incorrect? 🙏 Please contribute!
methods
TCPSocketClient.getoption
@return - The option value in case of success, or nil followed by an error message otherwise.
😱 Types incomplete or incorrect? 🙏 Please contribute!
@return - The option value in case of success, or nil followed by an error message otherwise.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Gets options for the TCP object. See setoption
for description of the option names and values.
TCPSocketClient.getpeername
@return - The IP address of the peer, the port number that the peer is using for the connection, and the family. In case of error, returns nil
.
😱 Types incomplete or incorrect? 🙏 Please contribute!
@return - The IP address of the peer, the port number that the peer is using for the connection, and the family. In case of error, returns nil
.
😱 Types incomplete or incorrect? 🙏 Please contribute!
@return - The IP address of the peer, the port number that the peer is using for the connection, and the family. In case of error, returns nil
.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Returns information about the remote side of a connected client object.
Note: It makes no sense to call this method on server objects.
TCPSocketClient.receive
function TCPSocketClient.receive(
pattern: (ReceivePatternMode|number)?,
prefix: string?
)
-> string?
-> (SocketError|string)?
pattern
- The default is "*l"
@param prefix
- Optional string to be concatenated to the beginning of any received data before return.
@return - Returns the received pattern when successful, otherwise nil and an error message.
😱 Types incomplete or incorrect? 🙏 Please contribute!
@return - Returns the received pattern when successful, otherwise nil and an error message.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Reads data from a client object, according to the specified read pattern. Patterns follow the Lua file I/O format, and the difference in performance between all patterns is negligible.
Important note: This function was changed severely. It used to support multiple patterns (but I have never seen this feature used) and now it doesn't anymore. Partial results used to be returned in the same way as successful results. This last feature violated the idea that all functions should return nil on error. Thus it was changed too.
TCPSocketClient.send
function TCPSocketClient.send(
data: string,
i: integer?,
j: integer?
)
-> integer?
-> (SocketError|string)?
-> integer?
data
- The string to be sent.
@return - On success the number of bytes sent, otherwise nil followed by an error message, followed by the index of the last byte within [i, j]
that has been sent. You might want to try again from the byte following that.
😱 Types incomplete or incorrect? 🙏 Please contribute!
@return - On success the number of bytes sent, otherwise nil followed by an error message, followed by the index of the last byte within [i, j]
that has been sent. You might want to try again from the byte following that.
😱 Types incomplete or incorrect? 🙏 Please contribute!
@return - On success the number of bytes sent, otherwise nil followed by an error message, followed by the index of the last byte within [i, j]
that has been sent. You might want to try again from the byte following that.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Sends data through client object.
The optional arguments i
and j
work exactly like the standard string.sub
Lua function to allow the selection of a substring to be sent.
Note: Output is not buffered. For small strings, it is always better to concatenate them in Lua (with the '..' operator) and send the result in one call instead of calling the method several times.
TCPSocketClient.setoption
@param
option
- A string with the option name
@param value
- Depends on the option being set
@return - 1 on success, nil and an error message otherwise.
@return - 1 on success, nil and an error message otherwise.
Sets options for the TCP object. Options are only needed by low-level or time-critical applications. You should only modify an option if you are sure you need it.
TCPSocketClient.shutdown
@param
mode
- Determines which way of the connection should be shut down.
@return - Always returns 1.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Shuts down part of a full-duplex connection.