Home Texas Server Home Page

System::SocketConnect

System::SocketConnect opens a TCP connection to a remote host. The script must have the security setting CTScript::ALLOW_SOCKET_CONNECT before the this method will succeed .
public System::SocketConnect(
   AString hostURL,
   AString service = "80",
   Integer flags = 1,
:  OSHandle socketHandle
);

Parameters

hostURL The URL for the remote host, can be both an valid DNS name or a numeric IP address.
service The port number for the remote application.
flags Reserved for future use.
socketHandle The returned socket handle if the method suceeds.

Return Values

The error.errorCode value will be set to the underlining OS error message code and the error.errorString will have a detailed description of the error

Remarks

Example Use

OSHandle socket;
System::SocketConnect("ekkySoftware.com":socket);
System::SocketSend(socket,"GET / HTTP/1.1\nUser-Agent: TScript Software http://www.ekkySoftware.com/\nHost: www.ekkysofware.com\n\n");
System::SocketReceive(socket:fileBuffer);
System::MessageBox(fileBuffer.AString().ToString(),L"File Contents of / at ekkySoftware");

Requirements

TScript Version:1.2

Also See

System::SocketGetInfo, System::SocketReceive, System::SocketSend

Copyright © 2009, Ekky Software Pty Ltd.