class TcpStream

extends Stream

Provides a tcp stream implementation of the standard stream object

class attributes [NB. Highlighted attributes are static members]
variable remoteip - After an accept(), this is set to the remote IP address.
variable remoteport - After an accept(), this is set to the remote port.
function TcpStream() - The constructor
function accept() - Accept an incomming connection
function listen() - Set the number of slots the system listens on for connections. 5-10 is a good number.
function poll() - Poll the socket for data to read

Functions

function TcpStream Click to go up to the list
The constructor
Declaration:
    native function TcpStream(number socket)
Description:
The TcpStream class is used for talking to remote TCP ports. It inherits from the standard Stream class, so methods such as println() work as expected. Do not create instances of this class directly- use Network.tcp_connect() to connect to a remote host and use Network.tcp_bind() to bind to a port, then call the accept() method to accept connections from remote hosts.
Parameters:
    Parameter #1: number socket - The fd of the network socket

function accept Click to go up to the list
Accept an incomming connection
Declaration:
    native function accept()
Description:
This function will accept a connection and return a Sys.TcpStream object. This function will only work if the socket was initially created using Network.tcp_bind().

function listen Click to go up to the list
Set the number of slots the system listens on for connections. 5-10 is a good number.
Declaration:
    native function listen( number backlog )
Parameters:
    Parameter #1: number backlog - The number of slots

function poll Click to go up to the list
Poll the socket for data to read
Declaration:
    native function poll( number sleept )
Description:
This function is deprecated in favour of the generic Sys.select() support and may be removed soon.
Parameters:
    Parameter #1: number sleept - The amount of time to sleep in micro seconds

Variables

string remoteip Click to go up to the list
After an accept(), this is set to the remote IP address.

string remoteport Click to go up to the list
After an accept(), this is set to the remote port.

Automatically generated at 8:45pm, Wednesday 08 January 2003 by feritedoc.