4

I have a simple server listening on a Unix domain socket (on a CentOS box in case that's important). When I send the command "DATE" to the socket it writes back a welcome message and then "APRIL 15 2015". I can do this manually using the command:

socat - UNIX-CONNECT:/tmp/server.sock

but I now want to script it. I can send my DATE command to the socket by piping the output of echo to the above, but then socat returns with only the welcome message. I'm not sure if socat is returning just the first 2 lines, or waiting for a quiet period before closing the socket, or what. eg:

echo "DATE" | socat - UNIX-CONNECT:/tmp/server.sock

How can I make socat capture the whole response before disconnecting? I've tried -t and -T parameters to make it wait 5 seconds but that has no effect, socat returns immediately.

migrated from serverfault.com Apr 14 '15 at 23:25

This question came from our site for system and network administrators.

  • how about socat -T3 -,ignoreeof .. ? – user133929 Sep 13 '15 at 7:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.