Take the 2-minute tour ×

I'm connecting to real-time data on a remote server as a client. I want to send the following to a server and keep the connection open. This is a 'push' protocol.


I can call this in a browser and it's fine. However, if I try to use telnet directly in a windows command prompt, the prompt just exits.

  GET protocol/dosomething.txt?POSTDATA=thePostData

The same is the case if I use Putty.exe and select Telnet as the protocol. I can't see a way to do this with Hercules at all, as I don't think the server will interpret the GET

Is there any way I can do this?


share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You have to match the HTTP protocol (RFC2616) to the letter if you want to use telnet. Try something like:

shell$ telnet www.google.com 80
Connected to www.google.com (
Escape character is '^]'.
GET / HTTP/1.1
Host: www.google.com:80
Connection: close

HTTP/1.1 200 OK
Date: Tue, 11 Sep 2012 15:09:51 GMT

You need to type the following lines including an "empty line" following the "Connection" line.

GET / HTTP/1.1
Host: www.google.com:80
Connection: close
share|improve this answer
Ah.... I forgot, they have local echo turned off by default. Start with just running telnet with no arguments. Then type set localecho and then open www.google.com 80. You should be able to use just about any terminal emulator that understands telnet. –  D.Shawley Sep 11 '12 at 15:17
You should be able to connect a TCP socket to port 80 and send the same text. Just make sure to terminate lines with a CR-NL pair ("\r\n") and include the empty line following the headers. Then read the response and close the socket when you are done. –  D.Shawley Sep 12 '12 at 14:42
Thanks again for the help. I'm not getting any reply when I send the data. My syntax is incorrect, I think. I'm doing this with Hercules (TCP client): connecting to server.domain.com on 80. I get a 'connected' response. Then I'm sending this: GET\r\n/protocol/dosomething.txt?POSTDATA=thePostData\r\nHTTP/1.0\r\n\r\n I've tried various permutations, but to no avail.I don't even get a response from Google when I send this: GET / HTTP/1.0\r\n\r\n. –  user971580 Sep 13 '12 at 15:00
add comment

Your Answer

