Framework EDI Reference. Methods and Properties
ediTransport. TestConnection

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:

  1. Makes a socket connection to the destination server.
  2. Waits and receives a reply from the server.
  3. Sends an ECHO command.
  4. Waits and receives reply from server.
  5. Sends a QUIT command to disconnect from the server.
  6. Waits and receives reply from server.

FTP.  For a successful FTP connection, the following series of operations must be successful:

  1. 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.
  2. 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