From: Greg Vaughn Date: 2003-10-13T13:49:17+09:00 Subject: Getting incomplete reply from socket I must be missing something. I'm still fairly new to ruby, so I shouldn't be too surprised. My first real ruby 'project' is to script telling my wireless router to connect and disconnect the modem. I've got that part working, but I wanted to add a feature to poll the log of the router until I actually get connected. I should mention that this router does not strictly follow the http spec. In some cases it returns no http header, and when it does, the content length is usually wrong. These seem to throw the HTTP library for a loop (curl too), so I dropped down to the socket library for my work. When I access the log on the router, here's the type of thing it really returns (captured via netcat): HTTP/1.0 200 OK Pragma: no-cache Content-Length: 24 Content-Type: application/octet-stream 2003/10/10 20:25:27 Modem starts to dial up to *70,xxx-xxx-xxxx 2003/10/10 20:25:28 Wait for modem's response. 2003/10/10 20:26:37 Since modem has no response. Hang up! 2003/10/10 20:26:42 Modem starts to dial up to *70,xxx-xxx-xxxx 2003/10/10 20:26:43 Wait for modem's response. 2003/10/10 20:27:12 Modem connection baud rate: 48000 2003/10/10 20:27:12 Modem starts PPP. 2003/10/10 20:27:12 Username and Password : OK 2003/10/10 20:27:16 Modem get IP : yy.yy.yy.yy Here's the ruby I'm using to call it: def networkSend(tosend) reply = "" TCPSocket.open($host, $port) do |aSession| aSession.send(tosend, 0) reply = aSession.recv(10000) end return reply end This is what I get out of ruby (with a trailing blank line): HTTP/1.0 200 OK Pragma: no-cache Content-Length: 24 Content-Type: application/octet-stream It seems to be missing the body of the message. Does anyone know why? This happens both on ruby 1.6.7 and 1.8 on Mac OS X. -Greg Vaughn