|  | Quantum Leaps, LLC info@state-machine.com www.state-machine.com

# UDP Example

The example application opens a UDP connection at the port 777. Any UDP packets sent to that connection are interpreted as text to display on the LCD. The application responds back to the sender with a UDP packet that contains the original text plus the prepened sequence number. Obviously, the simple text format is used for simplicity. In real-life applications binary format could be more efficient.

To facilitate testing of UDP connectivity, a simple console application called `qudp` for Windows or Linux hosts is provided in the QP-lwIP example code. The following listing shows an example output generated from the `qudp` applicaiton:

    C:\software\qpcpp\tools\qudp\win32\vc6>Debug\qudp 192.168.0.100
    qudp utility (c) Quantum Leaps, LLC, www.state-machine.com
    Opening and binding local socket at port=1777...ready
    Remote UDP connection: IP-address=192.168.0.100, port=777
    Type command(s); press Enter to send command, ESC to quit
    Hello
    Sending:  "Hello"
    Received: "Hello-1"
    How are
    Sending:  "How are"
    Received: "How are-2"
    you?
    Sending:  "you?"
    Received: "you?-3"
    Done.

Please refer to the Quantum Leaps Application Note: "QP and lwIP TCP/IP Stack" for more information. The Application Note in PDF is provided in the QP-lwIP example code.