MsgCommunicator: Delphi Instant Messaging (IM) SDK
for easy creation of custom messenger system


TMsgClient.ConnectDirectly
TMsgClient
Top 

Opens a direct connection.

procedure ConnectDirectly(UserID: Cardinal; Host: String = ''; Port: Integer = 0);

Description
Call Connect to establish a connection to another client.

You should have Active property set to True to allow direct connecting before calling ConnectDirectly, in other case ConnectDirectly do nothing.

Connect tries to send command to the client you specify by UserID (and Host / Port), waits for an answer, then sets the ConnectedDirectly property to True if this operation executed successfully. You can check ConnectedDirectly property to learn does this client has opened direct connection(s) or not.

In client-server mode, you can learn host and port parameters from TMsgUserInfo record from contact list by calling GetMyContactsList or from user details by calling GetUserInfo. You can even omit host and port parameters, in this case they will determined automatically.

In peer-to-peer mode, you must specify host and port of a remote client to establish a connection.

Despite of the mode you work in, you have no needs to set direct connection manually. When you send message directly (by default) for the first time, direct connection will be established implicitly and it will be used for this sending as well as for further message exchange.



© AidAim Software MsgCommunicator: Delphi Messenger Sdk Instant Messaging Sdk Im Sd