soConnect (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

All

Firmware version:

1.08.00


The soConnect function establishes a connection to the specified address.

 

On a blocking socket, the return value indicates success or failure of the connection attempt.

With a non-blocking socket, the connection attempt cannot be completed immediately. In this case soConnect will return -4; however the connection attempt continues.

 

When a connection between sockets is broken, the socket that was connected should be discarded and a new socket should be created. When a problem develops on a connected socket, it must be discarded and a new socket should be created, in order to return to a stable point.

 

For a connectionless socket (type _SO_TYPE_DGRAM), the operation performed by this function is merely to establish a default destination address that can be used on subsequent calls to the soSend function.

 

 

Input:

socket : SYSHANDLE

Handle to the socket.

 

address : STRING

The address to connect to.

See also soAddrInetSet.

 

 

Returns: INT

1

- Success.

0

- The function is not supported.

-1

- The handle is not a valid socket.

-2

- One or more parameters are illegal.

-3

- The socket is closed.

-4

- The socket is marked non-blocking and the operation would block.

-5

- The socket does not support this action.

-7

- The socket already have a connection.

-8

- The local address is already used by another socket.

-9

- The connection attempt was aborted.

-10

- Failed to connect to remote address.

-15

- It is not possible to open a new socket.

-17

- Generic error.

-101

- The certificate can not be validated.

-102

- The certificate is expired or not yet valid.

-103

- The root certificate cannot be validated.

-105

- The TLS handshake failed.

 

 

Declaration:

FUNCTION soConnect : INT;
VAR_INPUT
  socket  : SYSHANDLE;
  address : STRING;
END_VAR;

 

 


Example:

 

Please see the "Examples - Web client"