public class Socket implements AutoClosable:
| Modifier and Type | Member | Description |
|---|---|---|
| public readonly property | isConnectedisConnected as Boolean: |
Returns true when the socket has a valid native handle. |
| public readonly property | readerreader as SocketReader: |
Read-only property alias for `getReader()`. |
| public readonly property | remoteSocketAddressremoteSocketAddress as SocketAddress: |
Returns the remote socket endpoint when known. |
| public readonly property | writerwriter as SocketWriter: |
Read-only property alias for `getWriter()`. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | SocketSocket() throws IOException: |
Creates a socket and connects when endpoint parameters are provided. |
| public | SocketSocket(host as String, port as Int) throws IOException: |
Creates a socket and connects when endpoint parameters are provided. |
| public | SocketSocket(host as String, port as Int, timeoutMillis as Int) throws IOException: |
No summary. |
| Modifier and Type | Member | Description |
|---|---|---|
| public override | closeclose() as Void throws IOException: |
Closes the socket. |
| public | connectconnect(host as String, port as Int) as Void throws IOException: |
Connects this socket. |
| public | connectWithTimeoutconnectWithTimeout(host as String, port as Int, timeoutMillis as Int) as Void throws IOException: |
No summary. |
| public | getInputStreamgetInputStream() as SocketInputStream: |
Returns the input stream wrapper. |
| public | getOutputStreamgetOutputStream() as SocketOutputStream: |
Returns the output stream wrapper. |
| public | getReadergetReader() as SocketReader: |
Returns a text reader facade over this socket. |
| public | getWritergetWriter() as SocketWriter: |
Returns a text writer facade over this socket. |
| public | readAllTextreadAllText() as String throws IOException: |
Reads the whole socket stream as text. |
| public | readLinereadLine() as String throws IOException: |
Reads a logical line and strips the trailing newline. |
| public | receivereceive() as String throws IOException: |
Receives text data from the peer. |
| public | receivereceive(maxBytes as Int) as String throws IOException: |
Receives text data from the peer. |
| public | receiveBytesreceiveBytes(maxBytes as Int = 4096) as Byte[] throws IOException: |
Receives raw bytes from the peer. |
| public | sendsend(data as String) as Boolean throws IOException: |
Sends text data to the peer. |
| public | sendBytessendBytes(data as Byte[]) as Int throws IOException: |
Sends raw bytes to the peer. |
| public | setTimeoutMillissetTimeoutMillis(timeoutMillis as Int) as Void throws IOException: |
No summary. |
| public | writewrite(readonly value as String) as Void throws IOException: |
Writes raw text to the socket. |
| public | writeByteswriteBytes(readonly value as Byte[]) as Void throws IOException: |
Writes raw bytes to the socket. |
| public | writeLinewriteLine(readonly value as String) as Void throws IOException: |
Writes one line to the socket. |