tcp connection to a web server - TCP-IP

This is a discussion on tcp connection to a web server - TCP-IP ; hello everyone, i have a problem regarding networking apis of unix linke systems ....i don know this is the best place this request but i cudnt get one .(so also suggest where to ask such questions) the problem is that ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: tcp connection to a web server

  1. tcp connection to a web server

    hello everyone,

    i have a problem regarding networking apis of unix linke systems ....i
    don know this is the best place this
    request but i cudnt get one .(so also suggest where to ask such
    questions)

    the problem is that after finally connecting to the server when i send
    a get request the server returns bad request error ...i use something
    like:

    write(sockfd,"GET /index.html \r\n Host: 10.10.19.222:80\r\n\r\n",
    50); /*the size argument actually is given */
    /
    *by the sizeof operator of c (here i wrote 50*/

    where is the problem in the system (server ,code ,write() ,etc)
    the server is apache running on my local machine ....

    how are \r\n interpreted by write() .....
    i use fedora8(linux)

    thanks a lot
    Mohan

  2. Re: tcp connection to a web server

    On Sat, 08 Nov 2008 10:06:05 -0800, mohi wrote:

    > hello everyone,
    >
    > i have a problem regarding networking apis of unix linke systems ....i
    > don know this is the best place this
    > request but i cudnt get one .(so also suggest where to ask such
    > questions)
    >
    > the problem is that after finally connecting to the server when i send a
    > get request the server returns bad request error ...i use something
    > like:
    >
    > write(sockfd,"GET /index.html \r\n Host: 10.10.19.222:80\r\n\r\n", 50);

    ^

    Maybe that space is your problem.

    M4

  3. Re: tcp connection to a web server

    On Nov 8, 10:06*am, mohi wrote:

    > write(sockfd,"GET /index.html \r\n Host: 10.10.19.222:80\r\n\r\n",
    > 50); * /*the size argument *actually is given */
    > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * * * * * * * * * * * * /
    > *by the sizeof operator of c (here i wrote 50*/


    Paste your actual code. Odds are that you are misusing the 'sizeof'
    operation. It's almost impossible to use 'sizeof' to correctly give
    you the length of a string.

    DS

+ Reply to Thread