O seguinte funcionou, você deve especificar o frameheader
printf '\x00\x00\x00\x00\x00\x01\x00\x00stats\r\n' | nc -u 127.0.0.1 11211
Estou tentando enviar o comando stats
para o memcached via netcat, no entanto, não estou recebendo nada do memcached ...
Eu tentei
echo "stats" > commands.txt
nc -u 127.0.0.1 11211 < commands.txt
Eu também tentei
echo stats | nc -u 127.0.0.1 11211
Do que eu li na parte inferior da Documentação do Memcached , linha 1176 , o comando ao ser enviado pode ter que incluir
Each UDP datagram contains a simple frame header, followed by data in the
same format as the TCP protocol described above. In the current
implementation, requests must be contained in a single UDP datagram, but
responses may span several datagrams. (The only common requests that would
span multiple datagrams are huge multi-key "get" requests and "set"
requests, both of which are more suitable to TCP transport for reliability
reasons anyway.)
The frame header is 8 bytes long, as follows (all values are 16-bit integers
in network byte order, high byte first):
0-1 Request ID
2-3 Sequence number
4-5 Total number of datagrams in this message
6-7 Reserved for future use; must be 0
Minha pergunta é: Como eu envio o comando stats
via udp para o Memcached usando o netcat?