fseek() on socket

This is a discussion on fseek() on socket within the Networking/Device Communication forums, part of the General Programming Boards category; Originally Posted by Salem So how do you develop a networking program, if there's nothing to talk to? I communicate ...

  1. #16
    Registered User
    Join Date
    Sep 2003
    Posts
    224
    Quote Originally Posted by Salem
    So how do you develop a networking program, if there's nothing to talk to?
    I communicate with localhost.

    So long as the machines are on the same local subnet, you can run ethereal on any of them, and see all local traffic no matter which machine originated it.
    None of the machines on our network have Ethereal.

    It turns out that the Content-Range header is a response header. To send a range request you need to send the Range header. Example:
    Code:
       $out = "GET /bs.html HTTP/1.1\r\n";
       $out .= "Accept: */*\r\n";
       $out .= "Range: bytes=3000000-3000999\r\n";
       $out .= "Host: localhost\r\n";
       $out .= "Connection: Close\r\n\r\n";
    This works on my machine running Apache 2.0.52. However, when I connect to the remote site, which runs Apache 1.3.33, range requests do not work; the entire file is returned. Doesn't Apache 1.3.33 support HTTP 1.1? Here is the request I send:
    Code:
       $out = "GET /blog/index.php?p=48 HTTP/1.1\r\n";
       $out .= "Accept: */*\r\n";
       $out .= "Range: bytes=3000000-3000999\r\n";
       $out .= "Host: brokensaints.com\r\n";
       $out .= "Connection: Close\r\n\r\n";
    This is the response header I get:
    Code:
    HTTP/1.1 200 OK
    Date: Tue, 24 May 2005 18:35:46 GMT
    Server: Apache/1.3.33 (Debian GNU/Linux) mod_gzip/1.3.26.1a PHP/4.3.10-13 mod_ssl/2.8.22 OpenSSL/0.9.7d mod_perl/1.29
    X-Powered-By: PHP/4.3.10-13
    X-Pingback: http://brokensaints.com/blog/xmlrpc.php
    Connection: close
    Transfer-Encoding: chunked
    Content-Type: text/html; charset=UTF-8

  2. #17
    Registered User
    Join Date
    Sep 2003
    Posts
    224
    The Range requests, however, work for static pages fine. This is obviously dynamic.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Non-blocking socket connection problem
    By cbalu in forum Linux Programming
    Replies: 25
    Last Post: 06-03-2009, 02:15 AM
  2. socket programming question, closing sockets...
    By ursula in forum Networking/Device Communication
    Replies: 2
    Last Post: 05-31-2009, 05:17 PM
  3. when to close a socket
    By Wisefool in forum Networking/Device Communication
    Replies: 5
    Last Post: 11-02-2003, 09:33 AM
  4. problem closing a socket
    By Wisefool in forum C Programming
    Replies: 1
    Last Post: 10-28-2003, 12:38 PM
  5. socket newbie, losing a few chars from server to client
    By registering in forum Linux Programming
    Replies: 2
    Last Post: 06-07-2003, 11:48 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21