Public Functions
TCPObject connectToURL (
string url — The URL to connect to. For example, http://mods.greek2me.us/example.php?param=test&whatever.
string method — The HTTP method to use. (GET, POST, PUT, etc.) Defaults to GET if blank. Be sure to urlEnc() parameters.
string savePath — The local filepath to save binary files to. Text files will only download in binary mode if this is set.
string class — The name of a class which can be used to change/extend functionality.
)


Creates a connection to the server at the specified URL.

Returns:
The TCP object that is performing the connection.
See Also:
TCPClient
39function connectToURL ( %url, %method, %savePath, %class )
TCPObject TCPClient (
string method — The HTTP method to use. (GET, POST, PUT, etc.)
string server — The server to connect to.
int port — The port to use. Defaults to 80 if blank.
string path — The location of the file on the server. Defaults to \"/\" if blank.
string query — The parameters to be sent with the request. Be sure to use urlEnc() on the parameters. Must be formatted like this: myArg=value&testarg=stuff&whatever=1
string savePath — The local filepath to save binary files to. Text files will only download in binary mode if this is set.
string class — The name of a class which can be used to change/extend functionality.
)


Creates a TCP connection to the specified server. If desired, a custom request can be specified immediately after function call using %tcp.request.

Returns:
The TCP object that is performing the connection.
69function TCPClient ( %method, %server, %port, %path, %query, %savePath, %class )
void TCPClient::buildRequest (
TCPClient this
)


Creates the request which is sent to the server.

108function TCPClient::buildRequest ( %this )
void TCPClient::handleText (
TCPClient this
string text
)


Used when downloading text files. To use with your mod, replace "TCPClient" with your class name.

Only called when downloading text files and the "savePath" variable is blank.

384function TCPClient::handleText ( %this, %text )
void TCPClient::onBinChunk (
TCPClient this
int chunk — The number of bytes received.
)


Called when a binary chunk is received. To use with your mod, replace "TCPClient" with your class name.

Only called when in binary mode.

See Also:
TCPClient::setProgressBar
334function TCPClient::onBinChunk ( %this, %chunk )
void TCPClient::onConnected (
TCPClient this
)


Called when the connection has been established. To use with your mod, replace "TCPClient" with your class name.

134function TCPClient::onConnected ( %this )
int TCPClient::onDone (
TCPClient this
int error
)


Called when the connection has completed. To use with your mod, replace "TCPClient" with your class name.

Returns:
The error message, related to $TCPClient::Error::[none|connectionFailed|dnsFailed|invalidResponse|connectionTimedOut|invalidRedirect|invalidDownloadLocation|invalidUrlFormat]
199function TCPClient::onDone ( %this, %error )
void TCPClient::setProgressBar (
TCPClient this
float completed
)


Used to update a progress bar when downloading a binary file. To use with your mod, replace "TCPClient" with your class name.

Only called when in binary mode.

395function TCPClient::setProgressBar ( %this, %completed )
string urlGetComponents (
string url
)


Takes a full URL, like http://example.com/somepage.php?argument=blah&whatever,

and breaks it down into its components.

Returns:
protocol TAB server TAB port TAB path TAB query
410function urlGetComponents ( %url )

Private & Deprecated Functions
void TCPClient::onConnectFailed (
TCPClient this
)


Called when the connection has failed.

167function TCPClient::onConnectFailed ( %this )
void TCPClient::onDisconnect (
TCPClient this
)


Called when the connection is closed.

189function TCPClient::onDisconnect ( %this )
void TCPClient::onDNSFailed (
TCPClient this
)


Called when DNS has failed.

160function TCPClient::onDNSFailed ( %this )
void TCPClient::onLine (
TCPClient this
string line — The line received.
)


Called when a line is received from the server.

See Also:
TCPClient::handleText
TCPClient::onBinChunk
239function TCPClient::onLine ( %this, %line )
TCPObject TCPClientGET (
string server — The URL and (optionally) port of the server to connect to.
string path — The location of the file on the server.
string query — The parameters to be sent with the GET request. Be sure to use urlEnc() on the parameters. Must be formatted like this: myArg=value&testarg=stuff&whatever=1
string savePath — The local filepath to save binary (non-text) files to.
string class — The name of a class which can be used to change/extend functionality.
)


Deprecated: It is recommended that you do not use this function. It may be removed at a later date.

Creates a TCP connection and sends a GET request to the specified server.

Additional debugging is available by setting $TCPClient::Debug to true.

Returns:
The TCP object that is performing the connection.
518function TCPClientGET ( %server, %path, %query, %savePath, %class )
TCPObject TCPClientPOST (
string server — The URL and (optionally) port of the server to connect to.
string path — The location of the file on the server.
string query — The parameters to be sent with the POST request. Be sure to use urlEnc() on the parameters. Must be formatted like this: myArg=value&testarg=stuff&whatever=1
string savePath — The local filepath to save binary (non-text) files to.
string class — The name of a class which can be used to change/extend functionality.
)


Deprecated: It is recommended that you do not use this function. It may be removed at a later date.

Creates a TCP connection and sends a POST request to the specified server.

Additional debugging is available by setting $TCPClient::Debug to true.

Returns:
The TCP object that is performing the connection.
496function TCPClientPOST ( %server, %path, %query, %savePath, %class )