SetTimeout

The default timeout for sending / receiving data is 2 seconds. SetTimeout is used to set a different timeout both for sending and receiving data.

Syntax

SetTimeout(SendTimeout, RecieveTimeout)

Returns

No data returned.

More Information

SetTimeout needs to be set before setting the object which will be used for sending and receiving. Passed parameters for timeouts are in milliseconds. If -1 is passed as one of the value, the currently set value will be used.

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