TcpSocket Class extending Socket

/ Represents a TCP Socket connection, this connection can be unconnected in which case call connect. If you wish to spawn a raw TCP connection create a new instance of this class and then call the connect method /

Class Methods

Constructs this TcpSocket with a socket server and socket address

function __construct(TcpSocketServer socket_server, SocketAddress socket_address) : void

Constructs this TcpSocket with no parameters

function __construct() : void

Connects to the provided Ipv4 address and port

function connect(Ipv4Address address, number port) : void

Sends the given data string amount to the client
data string variable can contains binary data this is fine, null terminator is not monitored, pass correct amount of data to send
if this is a text string pass the size of the string in the amount

function send(string data, number amount) : number

Reads the amount of bytes specified from the socket stream as a string

function recv(number amount) : string