TCP Session API is asynchronous. All methods (except ITcpSession.stop) return promise objects. This means that they complete immediately and the caller needs to schedule a continuation to get the result of the operation. This can be done using the call to
Promise.then or using ES2017
Before the session can be used for data transfer, it must first be connected to remote endpoint by a call to ITcpSession.connect method. This method returns a promise that is completed when the connection succeeds or fails.
TCP Session object implements the ITcpSession.send method with three overloads that allows the user script to send the data to the TCP session. Use ITcpSession.receive method to read data from a TCP session.