send
send: (LineSocket, string) -> ()Send line with \r\n appended (queued until connected). A closed socket is SocketException; a line holding CR or LF is refused.
LineSocket.connect(…)| Method | Returns | Description |
|---|---|---|
send(string) | () | Send line with \r\n appended (queued until connected). A closed socket is SocketException; a line holding CR or LF is refused. |
close() | () | Close it: isClosed() is true at once, and onClose(socket, nil) follows at the next invoke point. Closing a closed socket does nothing. |
isConnected() | boolean | Whether it was connected: still true after it closed. |
isClosed() | boolean | Whether it is closed (by close(), the peer or an error). |
getHost() | string | The host it was opened to. |
getPort() | number | The remote port, or 0 until it is connected. |
connect(string, number, boolean, any) | LineSocket | Open a line-by-line connection to host:port (TLS when tls), through the account's proxy. listener is a table whose `onConnect(socket)… |
| Method | Returns | Description |
|---|---|---|
LineSocketClass.connect | LineSocket | Open a line-by-line connection to host:port (TLS when tls), through the account's proxy. listener is a table whose `onConnect(socket)… |
sendsend: (LineSocket, string) -> ()Send line with \r\n appended (queued until connected). A closed socket is SocketException; a line holding CR or LF is refused.
closeclose: (LineSocket) -> ()Close it: isClosed() is true at once, and onClose(socket, nil) follows at the next invoke point. Closing a closed socket does nothing.
isConnectedisConnected: (LineSocket) -> booleanWhether it was connected: still true after it closed.
isClosedisClosed: (LineSocket) -> booleanWhether it is closed (by close(), the peer or an error).
getHostgetHost: (LineSocket) -> stringThe host it was opened to.
getPortgetPort: (LineSocket) -> numberThe remote port, or 0 until it is connected.
connectconnect: (string, number, boolean, any) -> LineSocketOpen a line-by-line connection to host:port (TLS when tls), through the account's proxy. listener is a table whose onConnect(socket), onLine(socket, line) and onClose(socket, reason) run on the client thread (reason nil for a normal close, else the exception text). A marketplace plugin reaches no host: its connection is refused before anything is sent.