sock: TCP/IP socket functions

Top  Previous  Next

Socket functions are used for communicating over a mobile network or LAN. The sock() functions uses TCP/IP. For UDP/IP support, please see UDP/IP socket functions.

 

Please see the example program (shown for each function).

 


•sockConnect

Initiates a socket connection


•sockConnection

Returns the current status of a connection


•sockDisconnect

Disconnects a socket


•sockGetLocalIP

Returns the local IP address


•sockIPFromName

Converts a string to an IP address


•sockIPToName

Converts an IP address to a string


•sockListen

Listen for a connection


•sockReceive

Reads data from the connection


•sockSend

Sends data over the connection


•sockSetTCPIPParm

Sets connection parameters


•sockGetTCPIPParm

Reads the connection parameters

 

Please also see the example application section for examples.

 

For NX32L based devices it is recommended to use the Advanced so socket API.

 

IP address format:

In all places where an IP address aaa.bbb.ccc.ddd is stored in a DINT, the following format is used:

 

ddd is stored in bit 24..31.

ccc is stored in bit 16..23.

bbb is stored in bit 8..15.

aaa is stored in bit 0..7.