# TCPSocket
Start from base library version 2.18.0. Please remaining backward compatible.
One TCP Socket Instance, by default IPv4 agreement
# method
# TCPSocket.connect(Object options)
Start a connection on the given socket
# TCPSocket.write(String | ArrayBuffer data)
in socket Send data on
# TCPSocket.close()
Close the connection
# TCPSocket.onClose(function callback)
Once the wire is tapped, socket Full shutdown sends out the event
# TCPSocket.offClose(function callback)
Once we cancel the wiretap socket Full shutdown sends out the event
# TCPSocket.onConnect(function callback)
Listen in when a socket The event is triggered when the connection is successfully established
# TCPSocket.offConnect(function callback)
Cancel the wiretap when a socket The event is triggered when the connection is successfully established
# TCPSocket.onError(function callback)
Listen is triggered when an error occurs
# TCPSocket.offError(function callback)
Cancel Listen Triggered when an error occurs
# TCPSocket.onMessage(function callback)
Monitor triggers the event when data is received
# TCPSocket.offMessage(function callback)
Cancels listening to trigger this event when data is received
# error
Error code | Error message | Introductions |
---|---|---|
-1 | System error | |
-2 | Socket interface error, refer to the system socket error code | |
-3 | Send failed, no interface permissions | |
1 | Send failed, parameter error, address illegal | |
2 | Send failed, parameter error, port illegal |