\n others require \r\n\r using
$ stty -a
and looking for lnext. It is ^V for me.
\r\n line endings$ telnet localhost 6379
-c or -C to send \r\n$ echo "get foo" | nc -C localhost 11211 > output.txt
$ socat - OPENSSL:duckduckgo.com:443
My wife wants you to know that it is "tacos" backwards
$ openssl s_client -connect www.google.com:443Example: Graphite
\n line endingsmetric.path.name value timestamp\n
Example:
wx.temp.chicago 78.2 1621913119\n
$ echo "wx.temp.chicago 78.2 `date +%s`" | nc localhost 2003
Example: IRC
\r\n, most servers accept \n:prefix command arg1 arg2 ... argN\r\n
:IRC is noisy, separate input from output
In one terminal do
touch irc-out; tail -f irc-out
In another terminal do
You'll see welcome messages in the other terminal
If the server sends you
PING :something
You need to (rather promptly) reply
PONG :something
... or it will drop your connection
Send
JOIN #test
Server Sends ("Replies")
:mynickname!myusername@$HOST JOIN #test
... to you and everyone in the channel
Send a message
PRIVMSG #test :Hello World!
Server Sends
:mynickname!myusername@$HOST PRIVMSG #test :Hello World!
... to everyone else in the channel
Example: Memcached
\r\n
set key flags expiration length\r\n
set key flags expiration length\r\n
set greeting 0 0 12\r\n
payload bytes, correct length\r\n
Hello World!\r\n
STORED\r\nERROR\r\nCLIENT_ERROR\r\nSERVER_ERROR\r\nOne key
get key1\r\n
Multiple keys
get key1 key2 key3\r\n
For each key requested
VALUE key flags length\r\n
payload bytes, correct length\r\n
Then finally
END\r\n
Example: HTTP
\r\n, most servers accept \n
METHOD PATH HTTP/VERSION\r\n
Example:
GET / HTTP/1.1\r\n
HTTP/VERSION STATUS MESSAGE\r\n
Example:
HTTP/1.1 200 OK\r\n
\r\n\r\nConnection: closeContent-Length bytes and \r\nTransfer-Encoding: chunkedGo play with text-based protocols!