![Roving Networks RN-171 Скачать руководство пользователя страница 38](http://html1.mh-extra.com/html/roving-networks/rn-171/rn-171_user-manual-and-command-reference_1492508038.webp)
WiFly GSX
www.rovingnetworks.com
WiFlyRN171-um 2/23/2011
809 University Avenue
•
Los Gatos, CA 95032
•
Tel (408) 395-6539
~
38
~
11.
Sending data using UDP
11.1.
Overview
UDP is a connectionless protocol. There is no initial handshaking between the hosts to set up the UDP
connection. There are no acknowledgements sent by the receiver for UDP packets that it receives. This
makes UDP an unreliable protocol, as there is no guarantee that the data will be correctly delivered.
However, due to its connectionless nature, UDP is suited for applications that cannot tolerate too much
latency but can tolerate some errors in data. Transmission of video would be a good example of UDP
application.
To use UDP on the WiFly-GSX module, you will need to enable the UDP protocol using the command “set
ip proto 1”. You will also need to specify the remote host IP address and the local and remote port number
that you will use for UDP communications.
The commands to enable UDP data transfer are:
Associate to a network:
setwlanssid<string>
// set the network name
setwlan phrase <string>
// set the passphrase for WPA and WPA2 modes
Set up the protocol and port number
setip proto 1
// enable UDP as the protocol
setip host <ip address>
// set the IP address of remote host
setip remote <port>
// set the remote port number on which the host is listening
setip local <port>
// set the port number on which the WiFly module will listen
save
//saves the settings in config file
reboot
//reboots
the
module
so that the above settings take effect
NOTE:
If you attempt to send data by physically typing characters on the keyboard or if your
microcontroller is not sending data fast enough, the WiFly module will send out packets with less data bytes.
To avoid this, set the flushtimer to a higher value. By default, it is set to 10 milliseconds. You can choose to
either disable forwarding based on flush timer (use “set comm. time 0”) or set it to a higher value (e.g. set
comm. time 2000)
Since UDP is a connectionless protocol, data will start flowing as soon as the module is rebooted. Unlike
TCP, it is not required to do an “OPEN” for the connection to be established. The WiFly-GSX module acts
like a data-pipe, so the UART data will be sent over the Wi-Fi link via the UDP protocol (in this case) and
the data coming over the Wi-Fi link (via UDP protocol in this case) will be sent to the UART.