Socket functions

Top  Previous  Next

Socket functions are used for communicating over a cellular network or LAN.

 

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

 

The sock() functions uses TCP/IP.


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

 

The UDP socket functions are used for communicating over the internet via IP-networks. The udp() functions use UDP/IP.


udpReceive

Receive data


udpSend

Send data


udpStartListen

Starts to listen for data


udpStopListen

Stop listening for data

 

 

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.