Avisaro Online Documentation - Wiki
Impressum Kontakt Sitemap

UDP

Description

UDP opens a UDP channel, for both, transmission and reception.

Parameters

UDP requires at least 4 and can have one or two optional arguments. The arguments are as following:

1. Handle number
This is the handle (or socket) number of the new UDP channel. Any decimal value from 201 to 300 is allowed. If UDP succeeds, this number can be used in subsequent calls where a UDP socket number is required.

2. Outgoing IP address
This the IP address that is used as destination address for outgoing packets.

3. Outgoing port number
This is the port number of the remote socket. A remote UDP must listen on that socket top receive packets from this module.

4. Incoming port number
This is our port number. A remote UDP must send packets to this port number so that we can receive them.

5. TX delay value (optional)
This value only affects streaming mode. In streaming mode, small TX packets are delayed until more data arrives or time elapses. This is a little trick to make bigger packets and, therefore, better use of network bandwidth.

6. Use checksums or not (optional)
This argument, if given. must be one of the words "ON" or "OFF". ON means that checksums are generated for outgoing packets, whereas OFF means that no checksums will be used.

Return Value

ERR_OK (0) if command was accepted and the new channel is created.
ERR_ARGUMENT (4) if one or more arguments don't match.
ERR_NET_DOWN (39) if command was rejected because the network is just not functional.
ERR_FILE_OPEN (32) if command was rejected because that handle is already open by another socket

Example

UDP 201 192.168.0.1 111 222 1000 OFF 

Open an UDP channel with handle number 201 that listens on port 222. Transmissions over this channel will be send to 192.168.0.1,port 111. If using streaming mode, this socket collects outgoing data for max. 1 second.

Remarks

This command only makes sense on modules with a network interface (Ethernet or WLAN).