OpenTcp

OpenTcp is used to establish a connection with a remote server using TCP.

Syntax

OpenTcp(ip, port)

Returns

Socket Object.

Example

This Script displays the banner of an ftp server that is running locally. It can work with any ftp server by changing the value of the variable "ip":

Function Main

Dim SocketObject As Object

Dim ip As String

Dim port As String

Dim strResponse As String

Ip = "127.0.0.1"

Port = "21"

Socket.SetTimeout 5000,5000

Set SocketObject = Socket.OpenTcp(Ip,Port)

If Not SocketObject is Nothing Then

'check to see that the Object returned successfully

strResponse = SocketObject.Recv(1024)

echo(strResponse)

SocketObject.Close

End If

End Function