IAPI::ConnectSocketServerObject

property ConnectSocketServerObject.

Connects a TCP/IP client object to an instance of server. When a connection to a server happened well,

but in the meantime the network is broken or the server is gone, the ScriptEZ.API component provides

an auto-reconnection feature from within the client side without any extra work.

 

HRESULT ConnectSocketServerObject(
  BSTR  host_or_ip,
  long  svr_port, 
  long  hSocketClient, 
  long  *pVal  
);

Parameters

host_or_ip

[in] .   Hostname or IP address

 

Since version 2.38.0:

Passing host_or_ip = NULL and svr_port = 0 disconnects gracefully from the server.

 

Since version 2.38.3.4:

Passing host_or_ip = "?" checks if a connection is acknowledged by the server.

Using this call allows client code to poll that a connection is well established when providing/implementing

a callback onConnectionState(…) is unnecessary or not possible.

 

The returned value is 1 if well connected, 0 if not yet connected or failed.

svr_port

[in] .   Server port

hSocketClient

[in] .   Handle of  TCP/IP client object

pVal

[out, retval] The returned value is 0 if succeeded, other value if failed

 

Return Values

S_OK

The operation was successfull.

E_POINTER

A NULL pointer was supplied as an argument.

E_UNEXPECTED

An unexpected error occoured.

See Also

IAPI