Re: Trying to GET google with socket....problem



I just ran this code in irb, and it worked without issue.

Can you provide the specific exception or unexpected results?

On Sun, Apr 08, 2007 at 05:28:07AM +0900, Hey You wrote:
Well I don't know why the socket can't connect to Google. Here is my
source code:

require 'socket'
h = TCPSocket.new('www.google.ca',80)
h.print "GET /index.html HTTP/1.0\n\n"
a = h.read
puts a

I tried changing the HTTP to 1.1 but it still doesn't work.

--
Posted via http://www.ruby-forum.com/.


.



Relevant Pages

  • Re: Is it possible to share sockets between 2 processes under Wind
    ... expanded Windows CE source code, the source for MS' version of WinSock is in ... You'd have to figure out how to have socket I/O from one process end ... shared data area in the WinSock DLL?). ... A better architecture seems to me to be a single server ...
    (microsoft.public.windowsce.app.development)
  • Re: GnuPG 1.4.3
    ... from a UNIX system would get past the compilation problems, ... AF_UNIX socket instead of an AF_INET socket. ... unless you prefer to edit much of the source code. ...
    (comp.os.vms)
  • Re: CSocket / AsyncSelect after Accept
    ... > I have studied the source code in sockcore.cpp for hours and I cannot ... You meant Accept, not Attach(), correct? ... > notification behavior to be inherited from the listening socket, ... The following is included in the documentation for the Winsock accept ...
    (microsoft.public.vc.mfc)
  • Re: Socket.Connect fails after several successful attemps
    ... I don't have the source code for those objects, so no, I can't explain it. ... A reasonable explanation, though, would be that you should be calling ... Dispose for socket objects when you are done with them and those classes are ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Finding server with broadcast
    ... > I don't have the source code here right now, but I think you have to create ... > one socket for each ip address that you get from Dns.Resolve. ... > IPEndPoint using 0 for the port number. ... //Start server ...
    (microsoft.public.dotnet.languages.csharp)