Sample Header Ad - 728x90

Why does Ctrl+C clear the current input line in my Python socket-based Telnet-like shell?

0 votes
0 answers
34 views
I'm building a simple shell server using raw Python sockets (not using telnetlib). The client connects using PuTTY with the Telnet connection type. The server displays a basic prompt like: [user@hostname:~]# --- ## The issue: ## When I type a command (for example, wh0ami) and press Ctrl+C, the entire line is wiped and only a fresh prompt appears: [user@hostname:~]# wh0ami ← typed input ^C ← pressed Ctrl+C [user@hostname:~]# ← result: input line cleared --- ## What I expect: ## In typical terminal behavior (like Bash or real Telnet servers), I would expect to see something like: [user@hostname:~]# wh0ami^C [user@hostname:~]# But in my case, the previously typed input disappears completely after pressing Ctrl+C. --- ## Notes: ## - I’m not using raw terminal mode — and I’m unable to use it for my use case. --- ## Question: ## Why does Ctrl+C cause the current input line to be cleared in this setup? Is this normal Telnet behavior, or am I missing something related to how the input buffer or terminal display should be handled? What's the solution to this? Thanks in advance. ---
Asked by just.callme.client (51 rep)
Jun 17, 2025, 07:39 AM