Connect Method
      
 

Description

Initiates connection to remote TCPHandler (or TCP relay).

Return Type

None  

Syntax

object.Connect RemoteID

The Connect Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type TCPHandler.
ID Required. A String value. ID of remote peer.

Remarks

The Connect method will try to connect to remote TCPHandler (or TCP Relay, if you're running one). It is assumed you have set up RemoteTCPHost and RemoteTCPPort properties. If you're connecting directly to remote peer, he should call Listen method on his side so he can accept the connection. Feel free to call Listen method on local side too, prior to calling the Connect method, and you can initiate Connect from remote peer at the same time. It doesn't matter who succeeds, it's important for connection to be established.

 

If connection is established, TCPConnected event will be fired. If you have connected directly to remote peer, then RemoteID argument in TCPConnected event will hold name of remote peer. If RemoteID is empty, it means you have successfully connected to TCP Relay, and it is still waiting for connection of remote peer.

 

RemoteID argument must be the same as remote peer's MyID property - and vice versa.