ShspSocketSingleton class
SHSP Socket implementation wrapping RawDatagramSocket
- Inheritance
-
- Object
- RawShspSocket
- ShspSocket
- ShspSocketSingleton
Properties
- address → InternetAddress
-
The address used by this socket.
no setterinherited
- broadcastEnabled ↔ bool
-
Whether IPv4 broadcast is enabled.
getter/setter pairinherited
- compressionCodec → ICompressionCodec
-
Get the compression codec used for data messages
no setterinherited
-
first
→ Future<
RawSocketEvent> -
The first element of this stream.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isBroadcast → bool
-
Whether this stream is a broadcast stream.
no setterinherited
-
isEmpty
→ Future<
bool> -
Whether this stream contains any elements.
no setterinherited
-
last
→ Future<
RawSocketEvent> -
The last element of this stream.
no setterinherited
-
length
→ Future<
int> -
The number of elements in this stream.
no setterinherited
- localAddress → InternetAddress?
-
Get local address (null if not bound)
no setterinherited
- localPort → int?
-
Get local port (null if not bound)
no setterinherited
- multicastHops ↔ int
-
The maximum network hops for multicast packages
originating from this socket.
getter/setter pairinherited
- multicastInterface ↔ NetworkInterface?
-
The network interface used for outgoing multicast packages.
getter/setter pairinherited
- multicastLoopback ↔ bool
-
Whether multicast traffic is looped back to the host.
getter/setter pairinherited
- onClose → CallbackOn
-
Get the callback executed when the socket closes
no setterinherited
- onError → CallbackOnError
-
Get the callback invoked when the socket encounters an error
no setterinherited
- onListening → CallbackOn
-
Get the callback invoked when the socket begins listening
no setterinherited
- port → int
-
The port used by this socket.
no setterinherited
- readEventsEnabled ↔ bool
-
Whether the RawDatagramSocket should listen for
RawSocketEvent.read events.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
single
→ Future<
RawSocketEvent> -
The single element of this stream.
no setterinherited
- socket → RawDatagramSocket
-
Get the underlying RawDatagramSocket
no setterinherited
- writeEventsEnabled ↔ bool
-
Whether the RawDatagramSocket should listen for
RawSocketEvent.write events.
getter/setter pairinherited
Methods
-
any(
bool test(RawSocketEvent)) → Future< bool> -
Checks whether
testaccepts any element provided by this stream.inherited -
asBroadcastStream(
{void onListen(StreamSubscription< RawSocketEvent> )?, void onCancel(StreamSubscription<RawSocketEvent> )?}) → Stream<RawSocketEvent> -
Returns a multi-subscription stream that produces the same events as this.
inherited
-
asyncExpand<
E> (Stream< E> ? convert(RawSocketEvent)) → Stream<E> -
Transforms each element into a sequence of asynchronous events.
inherited
-
asyncMap<
E> (FutureOr< E> convert(RawSocketEvent)) → Stream<E> -
Creates a new stream with each data event of this stream asynchronously
mapped to a new event.
inherited
-
cast<
R> () → Stream< R> -
Adapt this stream to be a
Stream<R>.inherited -
close(
) → void -
Closes the datagram socket.
inherited
-
contains(
Object? needle) → Future< bool> -
Returns whether
needleoccurs in the elements provided by this stream.inherited -
distinct(
[bool equals(RawSocketEvent, RawSocketEvent)?]) → Stream< RawSocketEvent> -
Skips data events if they are equal to the previous data event.
inherited
-
drain<
E> ([E? futureValue]) → Future< E> -
Discards all data on this stream, but signals when it is done or an error
occurred.
inherited
-
elementAt(
int index) → Future< RawSocketEvent> -
Returns the value of the
indexth data event of this stream.inherited -
every(
bool test(RawSocketEvent)) → Future< bool> -
Checks whether
testaccepts all elements provided by this stream.inherited -
expand<
S> (Iterable< S> convert(RawSocketEvent)) → Stream<S> -
Transforms each element of this stream into a sequence of elements.
inherited
-
firstWhere(
bool test(RawSocketEvent), {RawSocketEvent orElse()?}) → Future< RawSocketEvent> -
Finds the first element of this stream matching
test.inherited -
fold<
T> (T initialValue, T combine(T, RawSocketEvent)) → Future< T> -
Combines a sequence of values by repeatedly applying
combine.inherited -
forEach(
void action(RawSocketEvent)) → Future< void> -
Executes
actionon each element of this stream.inherited -
getRawOption(
RawSocketOption option) → Uint8List -
Reads low level information about the RawSocket.
inherited
-
handleError(
Function onError, {bool test(dynamic)?}) → Stream< RawSocketEvent> -
Creates a wrapper Stream that intercepts some errors from this stream.
inherited
-
join(
[String separator = '']) → Future< String> -
Combines the string representation of elements into a single string.
inherited
-
joinMulticast(
InternetAddress group, [NetworkInterface? interface]) → void -
Joins a multicast group.
inherited
-
lastWhere(
bool test(RawSocketEvent), {RawSocketEvent orElse()?}) → Future< RawSocketEvent> -
Finds the last element in this stream matching
test.inherited -
leaveMulticast(
InternetAddress group, [NetworkInterface? interface]) → void -
Leaves a multicast group.
inherited
-
listen(
void onData(RawSocketEvent event)?, {Function? onError, void onDone()?, bool? cancelOnError}) → StreamSubscription< RawSocketEvent> -
Adds a subscription to this stream.
inherited
-
map<
S> (S convert(RawSocketEvent)) → Stream< S> -
Transforms each element of this stream into a new stream event.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onMessage(
List< int> msg, RemoteInfo rinfo) → void -
inherited
-
pipe(
StreamConsumer< RawSocketEvent> streamConsumer) → Future<void> -
Pipes the events of this stream into
streamConsumer.inherited -
receive(
) → Datagram? -
Receives a datagram.
inherited
-
reduce(
RawSocketEvent combine(RawSocketEvent, RawSocketEvent)) → Future< RawSocketEvent> -
Combines a sequence of values by repeatedly applying
combine.inherited -
removeMessageCallback(
PeerInfo peer, MessageCallbackFunction cb) → bool -
Removes a message callback associated with a specific remote endpoint
Returns true if a callback was removed, false if no callback was found
inherited
-
send(
List< int> buffer, InternetAddress address, int port) → int -
Asynchronously sends a datagram.
inherited
-
sendTo(
List< int> buffer, PeerInfo peer) → int -
Send data to a remote address (as string) and port
Returns the number of bytes written
inherited
-
serializedObject(
) → String -
Returns the socket state as a serialized string (type, endpoints, registered callbacks)
inherited
-
setCloseCallback(
void cb()) → void -
Registers the callback executed when the socket closes
inherited
-
setErrorCallback(
void cb(dynamic err)) → void -
Registers the callback invoked when the socket encounters an error
inherited
-
setListeningCallback(
void cb()) → void -
Registers the callback invoked when the socket begins listening
inherited
-
setMessageCallback(
PeerInfo peer, MessageCallbackFunction cb) → void -
Associates a callback with incoming messages from a specific remote endpoint
inherited
-
setRawOption(
RawSocketOption option) → void -
Customizes the RawSocket.
inherited
-
singleWhere(
bool test(RawSocketEvent), {RawSocketEvent orElse()?}) → Future< RawSocketEvent> -
Finds the single element in this stream matching
test.inherited -
skip(
int count) → Stream< RawSocketEvent> -
Skips the first
countdata events from this stream.inherited -
skipWhile(
bool test(RawSocketEvent)) → Stream< RawSocketEvent> -
Skip data events from this stream while they are matched by
test.inherited -
take(
int count) → Stream< RawSocketEvent> -
Provides at most the first
countdata events of this stream.inherited -
takeWhile(
bool test(RawSocketEvent)) → Stream< RawSocketEvent> -
Forwards data events while
testis successful.inherited -
timeout(
Duration timeLimit, {void onTimeout(EventSink< RawSocketEvent> )?}) → Stream<RawSocketEvent> -
Creates a new stream with the same events as this stream.
inherited
-
toList(
) → Future< List< RawSocketEvent> > -
Collects all elements of this stream in a List.
inherited
-
toSet(
) → Future< Set< RawSocketEvent> > -
Collects the data of this stream in a Set.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
transform<
S> (StreamTransformer< RawSocketEvent, S> streamTransformer) → Stream<S> -
Applies
streamTransformerto this stream.inherited -
where(
bool test(RawSocketEvent)) → Stream< RawSocketEvent> -
Creates a new stream from this stream that discards some elements.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → ShspSocketSingleton?
-
Returns the instance if already created, otherwise null
no setter
Static Methods
-
bind(
) → Future< ShspSocketSingleton> -
Async factory to create or return the singleton instance
Thread-safe: uses Completer to prevent race conditions
override
-
destroy(
) → void - Destroys the singleton and closes the socket