Files
swift-nio/Sources/NIOUDPEchoClient/README.md
Liam Flynn 65d6f63a39 UDP Echo Client Example. (#933)
* UDP echo client example.

Motivation:

There is a UDP echo server example but it does not currently have a machine client example.
The TCP echo server has both sample client and server examples and it would be preferable to match.
The UDP client connection also differs from both the UDP server and the TCP client, so it is good to provide and example of this difference.

Modifications:

Added a UDP client example and a matching readme file.
The main swift file is a similar to the TCP echo example as possible.

Result:

There is now a clear example of how to create a simple UDP client side connection.
2019-03-31 16:18:11 +01:00

562 B

NIOUDPEchoClient

This sample application provides a simple UDP echo client that will send a single line to a UDP echo server and wait for a response. Invoke it using one of the following syntaxes:

swift run NIOUDPEchoClient # Connects to a server on ::1, server UDP port 9999 and listening port 8888.
swift run NIOUDPEchoClient 9899 9888 # Connects to a server on ::1, server UDP port 9899 and listening port 9888
swift run NIOUDPEchoClient echo.example.com 9899 9888 # Connects to a server on echo.example.com:9899 and listens on UDP port 9888