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 = System::DNS_TYPE_A,
:  OSHandle socketHandle
);

Parameters

hostURLThe URL for the remote host, can be both an valid DNS name or a numeric IP address.
serviceThe port number for the remote application.
flagsSystem::DNS_TYPE_A for connections to the HostURL A Record
bitwise or with System::SSL_CONNECTION for a ssl connection.
socketHandleThe returned socket handle if the method suceeds.

Return Values

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

Remarks

  • System::SSL_CONNECTION was added in tscript version 1.4.
Example Use
  • TScript
main(){
   OSHandle socket;
   System::SocketConnect("ekkySoftware.com":socket);
   System::SocketSend(socket,"GET / HTTP/1.1\n"
     "User-Agent: TScript Software http://www.ekkySoftware.com/\n"
     "Host: www.ekkysofware.com\n\n"
   );
   System::SocketReceive(socket:fileBuffer);
   System::MessageBox(fileBuffer.AString().ToString(),
      u"File Contents of / at ekkySoftware");
}

Since

TScript Version: 1.2

Also See

System::SocketGetInfo, System::SocketReceive, System::SocketSend
Listen All
Comments (0)
Characters left: 2500
 

Contact Ekky

Thanks for your interest.

Ekky Software Customer Support Team.

Ekky Software Product Range
Ekky Software Homepage T-Accounts Online ObjectDatabase++ TScript Ekky Software Homepage T-Accounts Onlinee ObjectDatabase++ TScript