A non-blocking TCP socket.
A non-blocking TCP socket.
Net::Socket@
Start a connection to the given host and port. This is non-blocking and will immediately return. Use IsReady()
to wait for the connection to be ready.
bool
Starts listening on the given host and port.
bool
Starts listening on the given port using 0.0.0.0 as the host. Note that this will open up the port to the LAN, which may not be what you want.
bool
Closes the socket.
When this socket is listening, attempts to accept a client connection if one is trying to connect. If there is, it will be returned. If no client is waiting, this will return null.
Net::Socket@
This method is deprecated and should not be used. Consider using IsReady(), IsHungUp(), or Available() instead, depending on your use-case.
bool
This method is deprecated and should not be used. Use IsReady() instead.
bool
Returns true if the socket state currently has the hangup flag. Note that this flag may be set while there is still data in the buffer that can be read.
bool
Returns the number of bytes available to be read from the socket buffer.
int
Reads the given number of bytes and return it as a MemoryBuffer.
MemoryBuffer@
Writes the given string to the socket as-is. Returns false if the write did not succeed. Note that this behavior differs from Write(const string &in)
.
bool
Attempts to read up until the next newline character, and outputs the string (including the newline character) in str
. If no newline character is encountered, it will return false, leave str
unmodified, and no bytes will be consumed from the buffer.
bool
Writes a line of text to the socket. Returns false if the write did not succeed. This behaves the same as WriteRaw()
, except a newline is appended.
bool
Reads a string length from the buffer as a 32 bit unsigned integer, followed by the actual string. This complements Write(const string &in)
.
string
Writes an 8 bit signed integer to the socket. Returns false if the write did not succeed.
bool
Writes a 16 bit signed integer to the socket. Returns false if the write did not succeed.
bool
Writes a 32 bit signed integer to the socket. Returns false if the write did not succeed.
bool
Writes a 64 bit signed integer to the socket. Returns false if the write did not succeed.
bool
Writes an 8 bit unsigned integer to the socket. Returns false if the write did not succeed.
bool
Writes a 16 bit unsigned integer to the socket. Returns false if the write did not succeed.
bool
Writes a 32 bit unsigned integer to the socket. Returns false if the write did not succeed.
bool
Writes a 64 bit unsigned integer to the socket. Returns false if the write did not succeed.
bool
Writes a 32 bit float to the socket. Returns false if the write did not succeed.
bool
Writes a 64 bit double to the socket. Returns false if the write did not succeed.
bool
Writes a 32 bit unsigned integer for the length of the string to the socket, followed by the actual string. Returns false if the write did not succeed. Note that this behavior differs from WriteRaw()
.
bool
Reads a number of bytes from the given MemoryBuffer and writes them to the socket.
bool