ugh, how do I ctrl-C out of a connection to a remote server when I'm done?



Sometimes in an SSH window, I will try and connect to another host on
port 80 or 25, to see what happens if I send a request consisting of
certain headers, and what response the server sends back. The problem
is -- and this seems like a real newbie question, but nothing I have
tried works -- is that once I'm done getting the response back,
sometimes the remote server doesn't close the connection, and nothing
I do on my end - Ctrl-X, Ctrl-C, Ctrl-Z, or whatever -- causes the
connection to close. What do I press to make the connection close, so
that I get my shell prompt back?

(I am actually on a Windows machine using an SSH client to connect to
a CentOS host that I run, before telnetting from that CentOS host to
the remote host. However I'm not sure if that should matter since
when I press Ctrl-C or Ctrl-X or whatever, the SSH program seems to
pass that straight through to the remote CentOS host just as if I'd
pressed the same keys on a local terminal.)

A typical transcript looks like this. That ^X ^c junk at the end is
me jamming the Ctrl-C and Ctrl-X keys trying to make the connection
close.


[root@fast ~]# telnet www.facebook.com 80
Trying 69.63.176.40...
Connected to www.facebook.com (69.63.176.40).
Escape character is '^]'.
GET / HTTP/1.1
Host: www.facebook.com

HTTP/1.1 302 Found
Date: Fri, 27 Mar 2009 23:21:39 GMT
Server: Apache/1.3.41.fb2
P3P: CP="HONK"
Set-Cookie:
nectar=1238196099-7a322935129f35cbe1c755f1d46259a43cc4873c4990488c89e24;
expires=Sun, 20
-Mar-2039 23:21:39 GMT; path=/; domain=.facebook.com; httponly
Set-Cookie: datr=1238196099-
e50fea765c3369f89f388a31fba99cb84714e3a701e8dc49d01bb; expires=Sun, 26-
A
pr-2009 23:21:39 GMT; path=/; domain=.facebook.com; httponly
Location: http://www.facebook.com/common/browser.php
X-Cnection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8

0



^X

^X
^A
^Xxcc^Xc

.