Device class

A Device has an IP address and connects over a port. The design does not currently allow multiple connections using different ports from the same device.

A Device could have a name manually set or could take the name of the Host from which it was created from if the Host set a name.

You can send a message to a Device from the Client or Server. Before sending, check that the Device has been connected using the connected property. When a Device has just been discovered, it is in an unconnected state. The Client must Client.connectTo the Device which if successful, the Device will be in a connected state. After that, messages can be sent to the Device.

A Host maintains an internal socket with a Device it has connected to. You should not have access to the raw socket. Messages are sent as Packets which can handle several serializable formats. See Packet for more information.

Constructors

Device(String ip, int port)
Device.from({String ip, int port, String name: _UNKNOWN_DEVICE})

Properties

connected bool
Used to determine if messages can be sent to this host
read-only
hashCode int
The hash code for this object. [...]
read-only, override
ip String
Get the IP address registered for this host
read-only
name String
Get the name reported for this Device. This value may be the text "null" if the Host name was not set in the Server or Client.
read / write
port int
Get the communication port registered for this host
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
override

Operators

operator ==(Object other) bool
For now devices are unique based on their IP addresses irrespective of ports.
override