Reputation: 11
How do I write the message I sent to the txt file.
Upvotes: 1
Views: 13210
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
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