Server class
A Server listens for connections and keeps a list of all the connected devices
Constructors
- Server({String name, int multicastPort, IPVersion ipVersion, CustomAdvertisement customAdvertisement, DeviceDiscoveryListener deviceDiscoveryListener, ConnectionListener connectionListener, int serverSocketPort, bool enableDiscovery: true, ListenOn listenOn})
-
listenOn
Allows you to provide the IP address the server should listen on for Client connections. If none is provided, the Server will listen on all IP address found for the suppliedipVersion
[...]
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
-
interfaceAddresses
→ Future<
Iterable< Map< >NetworkInterface, Iterable< >InternetAddress> > -
Get a Map of all the interfaces and IP addresses found in the interfaces
read-only, inherited
-
interfaces
→ Future<
List< NetworkInterface> > -
Get all the interfaces found in this Host
read-only, inherited
- ipAddress → String
-
Get the first detected IP address which the host could listen on (if Server)
or connect using (if Client)
read-only, inherited
-
ipAddresses
→ Future<
Iterable< String> > -
Get all IP addresses for all IP versions
read-only, inherited
-
ipv4Addresses
→ Future<
Iterable< String> > -
Get all IP addresses for IPv4
read-only, inherited
-
ipv6Addresses
→ Future<
Iterable< String> > -
Get all IP addresses for IPv6
read-only, inherited
- multicastIPAddress → String
-
Get the multicast Group IP Address being used
read-only, inherited
- multicastPort → int
-
Get the multicast port
read-only, inherited
- name ↔ String
-
Get the name of this Host. Must have been set using the set property or constructor
read / write, inherited
- port → int
-
Get the port that the server is listening on. If the server is not yet ready,
this will return null. First await on the Server.ready before getting this
read-only
-
ready
→ Future<
bool> -
If the Host (Client/Server) has completed it's initialization phase
and is ready to start advertising/discovering services. [...]
read-only, inherited
- running → bool
-
Check if the server up and ready to receive reliable socket connections.
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
broadcast(
Packet packet, {bool reliable: false}) → Future< void> - Send a broadcast using either the multicast group for unreliable and the connected client sockets for reliable broadcast
-
disconnect(
) → Future< void> -
Shutdown the Server by Disconnecting from all sockets
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
pauseDiscovery(
) → void - This allows pausing the discovery advertisements
-
resumeDiscovery(
) → void - You can resumed a paused discovery advertisement
-
send(
Packet packet, Device device, {bool ignoreIfNotConnected: false}) → Future -
Hosts can send messages to other devices using the internal socket
contained in the Device. [...]
inherited
-
startDiscovery(
) → void - (Re)Start advertisements from this server to enable discovery on Clients
-
stopDiscovery(
) → void - Stop this Server from Advertising for Client discovery
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited