**This is an old revision of the document!**

Component: Internet

This component is provided by the Internet Card

Component name: internet.
Callbacks:

  • close(handle:number)
    Closes an open socket stream.
  • connect(address:string[, port:number]):number
    Opens a new TCP connection. Returns the handle of the connection.
  • read(handle:number[, n:number]):string
    Tries to read data from the socket stream. Returns the read byte array.
  • isTcpEnabled():boolean
    Returns whether TCP connections can be made (config setting).
  • write(handle:number, data:string):number
    Tries to write data to the socket stream. Returns the number of bytes written.
  • finishConnect(handle:number):boolean
    Ensures a socket is connected. Errors if the connection failed.
  • isHttpEnabled():boolean
    Returns whether HTTP requests can be made (config setting).
  • request(url:string[, postData:string]):boolean
    Starts an HTTP request. If this returns true, further results will be pushed using http_response signals.