websocat icon indicating copy to clipboard operation
websocat copied to clipboard

Difference between C-c and C-d signals

Open hjpotter92 opened this issue 4 years ago • 1 comments

┌┤✅├─┤ hjpotter92 ├─┤~├─┤ 🕠 05:31 PM │
└┴─ ⚡[..........] ┴─ ➜ websocat -B 120000000 ws://localhost:12345/
┌┤✅├─┤ hjpotter92 ├─┤~├─┤ 🕠 05:31 PM │
└┴─ ⚡[..........] ┴─ ➜ echo $?
0
┌┤✅├─┤ hjpotter92 ├─┤~├─┤ 🕠 05:32 PM │
└┴─ ⚡[..........] ┴─ ➜ websocat -B 120000000 ws://localhost:12345/
^C%
┌┤✅├─┤ hjpotter92 ├─┤~├─┤ 🕠 05:32 PM │
└┴─ ⚡[..........] ┴─ ➜ echo $?
0

The first time, I did a Ctrl-D keypress, with exit code of 0. The 2nd time, I did a Ctrl-C keypress, with same exit status.

Is there a difference in the state of socket connection? I did not receive a client closed the connection event when I did Ctrl-D.

hjpotter92 avatar Feb 21 '20 12:02 hjpotter92

Is there a difference in the state of socket connection? I did not receive a client closed the connection event when I did Ctrl-D.

Ctrl+D sends EOF to terminal and should result in a clean connection close. Websocat should sent a close frame. It is as if information to be sent were read from file and it reached the end of the file.

Ctrl+C simply terminates websocat and socket is closed without special control frame, probably just a FIN TCP packet.

-B 120000000

Note that data processing in websocat is not zero-copy. Expect some slowdown when dealing with gigant messages.

vi avatar Feb 21 '20 14:02 vi