tinkivinki
tinkivinki

Reputation: 11

Writing the data that comes with socat to the file

How do I write the message I sent to the txt file.

enter image description here

Upvotes: 1

Views: 13210

Answers (2)

jbedi
jbedi

Reputation: 11

You can use tee(1) to both print to stdout and write to a file:

socat -lu STDIO TCP-LISTEN:8080,reuseaddr |tee stdout.log

The default logging of socat still goes to stderr.

Upvotes: 1

Mark Setchell
Mark Setchell

Reputation: 207345

Your question is not very clear, but I think you want to write the data you receive from the socket into a file, so the receiving end becomes:

socat TCP-LISTEN:25,reuseaddr,fork OPEN:data.txt,creat,append

Upvotes: 3

Related Questions