Tests for ability to connect to the destination server.
Syntax:
Returns
Returns 1 if connection was made; otherwise 0 is returned.
Remarks
The TestConnection tests if the client can connect to the destination server. It does this by first attempting to connect to the server, and, if successful, the connection is closed. This method does not test if there is an existing connection with the destination server -- it only tests if it is able to do so.
SMTP. For a successful SMTP connection, the following series of operations must be successful:
- Makes a socket connection to the destination server.
- Waits and receives a reply from the server.
- Sends an ECHO command.
- Waits and receives reply from server.
- Sends a QUIT command to disconnect from the server.
- Waits and receives reply from server.
FTP. For a successful FTP connection, the following series of operations must be successful:
- Makes a connection to the destination server using the supplied name (or IP address), user name, and password. If successful, a handle is generated that identifies the connection.
- Closes the handle to disconnect from the server.
HTTP. Always returns a successful connection.
NOTE: This test is currently not useful for an HTTP connection.
Example
Dim oEdiDoc As Fredi.ediDocument
Dim oTransports As Fredi.ediTransports
Dim oTransport As Fredi.ediTransport
' Create instance of Framework EDI.
Set oEdiDoc = New Fredi.ediDocument
' Get transports object
Set oTransports = oEdiDoc.GetTransports
' Create single transport object for FTP protocol.
Set oTransport = oTransports.CreateTransport
' Enable FTP transport.
oTransport.SetFTP
oTransport.Address = "192.168.1.101"
If oTransport.TestConnection Then
MsgBox "Connected to FTP server."Else
MsgBox "Failed to connect to FTP server."End If
Samples