mirror of
https://github.com/apple/swift-nio
synced 2026-11-25 04:47:49 +00:00
Motivation: There is a UDP echo client which is very similar to the NIOEchoClient. The styles of these two examples should match closely so ‘diff’ comparing will show the pertinent API differences. Modifications: Add self tags to member variables in the TCP echo client. Add a self tag to a member variable in the HTTP1 server. Remove an assert from the echo client. Result: The code in the TCP and UDP examples now matches and fits the SwiftNIO style.
NIOEchoClient
This sample application provides a simple echo client that will send a single line to an echo server and wait for a response. Invoke it using one of the following syntaxes:
swift run NIOEchoClient # Connects to a server on ::1, port 9999.
swift run NIOEchoClient 9899 # Connects to a server on ::1, port 9899
swift run NIOEchoClient /path/to/unix/socket # Connects to a server using the given UNIX socket
swift run NIOEchoClient echo.example.com 9899 # Connects to a server on echo.example.com:9899