MessageSocket class
Packages data from a stream into messages, by wrapping messages with a prefixed length.
Note: I've added locks on sending and receiving, so message integrity should be safe, but you should
still be aware of the potential confusion/mixups inherent to having multiple threads communicate over
a single channel.
Constructors
- MessageSocket(Socket sock)
Properties
Methods
-
close(
) → Future< void> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
recvBytes(
) → Future< Uint8List?> - Result of [] simply means an empty message; result of null implies some kind of failure; likely a disconnect.
-
recvString(
{bool? allowMalformed = true}) → Future< String?> -
sendBytes(
Uint8List data) → Future< void> -
Send a message.
datashould be a list of bytes, or a string (which will then be encoded with utf-8.)
Throws exception on socket failure.
//DUMMY Doesn't throw. Just keeps going. Should probably fix that.
-
sendString(
String s) → Future< void> -
See
sendBytes -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited