Asynchornous Connection

Top  Previous  Next

This method try to establish the connection to the specified Host and Port. This call doesn't block the code execution, so you should use the OnConnect and OnConnectionFail events to determine whether the connection is succesfully established or not. Alternativally, you can make a call to WaitForConnect synchronous method.

 

The Host and Port properties must be set for the connection to be successfully established.

 

VB

tnxxxx.Connect()

 

Delphi

tnxxxx.Connect;

 

The following graphic shows the sequence of actions corresponding to the asynchronous Connect method:

 

 Host Integration Pack TN Bridge Vb.net C# Delphi ActiveX asynchronous connect method

 

Examples:

 

 VB:

 Private Sub cmdConnect_Click()

   telnet.Host = Edit1.Text

   telnet.Port = 23

   telnet.Connect()

 End Sub

 

 Private Sub telnet_OnConnect()

   MsgBox("Connected")

 End Sub

 

 Private Sub telnet_OnConnectionFail()

   MsgBox("Connection failed")

 End Sub

 

 Delphi:

 procedure TForm1.Button1Click(Sender: TObject);

 begin

   tnb3270.Host := Edit1.Text;

   tnb3270.Port := 23;

   tnb3270.Connect;

 end;

 

 procedure TForm1.tnb3270OnConnect(Sender: TObject);

 begin

   ShowMessage('Connected');

 end;

 

 procedure TForm1.tnb3270OnConnectionFail(Sender: TObject);

 begin

   ShowMessage('Connection failed');

 end;