TcpSocketConnection class
Properties
-
hashCode
→ int
-
The hash code for this object.
no setterinherited
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
canConnect(int timeOut, {int attempts = 1})
→ Future<bool>
-
Test the connection. It will try to connect to the endpoint and if it does, it will disconnect and return 'true' (otherwise false)
-
connect(int timeOut, Function callback, {int attempts = 1})
→ dynamic
-
Initializes the connection. Socket starts listening to server for data
'callback' function will be called whenever data is received. The developer elaborates the message received however he wants
No separator is used to split message into parts
-
connectEOM(int timeOut, String eom, Function callback, {int attempts = 1})
→ dynamic
-
Initializes the connection. Socket starts listening to server for data
'callback' function will be called when 'eom' is received
-
disconnect()
→ void
-
Stops the connection and close the socket
-
enableConsolePrint(bool enable)
→ dynamic
-
Shows events in the console with print method
-
isConnected()
→ bool
-
Checks if the socket is connected
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
sendMessage(String message)
→ void
-
Sends a message to server. Make sure to have established a connection before calling this method
Message will be sent as 'message'
-
sendMessageEOM(String message, String eom)
→ void
-
Sends a message to server. Make sure to have established a connection before calling this method
Message will be sent as 'message'+'eom'
-
toString()
→ String
-
A string representation of this object.
inherited