I had to implement HTTP/1.1 for the Palm for my application, so here are a
couple differences I noticed between your code and mine:
In the NetLibSocketOpen, I just use "0" or null for flags parameter (you
have netSocketProtoIPTCP); I don't know if that matters.
More importantly, your "(NetSocketAddrType *) &sockAddrP, &sockAddrPlenMine
" parameters might be causing trouble in your NetLibReceive call. I
dutifully supplied these parameters at first, but then found that they're
unnecessary for TCP, and in fact cause the call to puke. After passing
nulls (or zero), it worked fine.
-- Michael
"Susana Gasc�n Moreno" <[EMAIL PROTECTED]>@news.palmos.com on 06/08/2001
11:20:35 AM
Please respond to "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
cc:
Subject: Re: Problems sending an HTTP header to a Web Server
Hi again,
Thanks for what you told me, I have changed what I have leaving only the
two
new lines, but I still have the other problem, I get nothing from the
server.
I am sending a piece of code where I make the sending and receive part,
maybe I have something that shouldn�t been there.
Thanks for all the help.
// Open the socket
timeout = (UInt32)SysTicksPerSecond() * 20;
SocketRef = NetLibSocketOpen (NetLibNum, netSocketAddrINET,
netSocketTypeStream, netSocketProtoIPTCP, timeout, &errors);
// Resolve the FIXED ADDRESS
sockAddrP.family = netSocketAddrINET;
sockAddrP.port = NetHToNS(80);
IPAddr = NetLibAddrAToIN (NetLibNum, "172.19.1.48");
MemMove ((Char*)&sockAddrP.addr, (Char*)&IPAddr, sizeof(IPAddr));
// Make the connection
timeout = (UInt32)SysTicksPerSecond() * 20;
ConnectResult = NetLibSocketConnect (NetLibNum, SocketRef,
(NetSocketAddrType*) &sockAddrP, sizeof(sockAddrP) ,timeout,
&errors );
// Send data
timeout = (UInt32)SysTicksPerSecond() * 20;
lenbuffer = StrLen(buffer);
sockAddrPLen = sizeof(sockAddrP);
bytesSent = NetLibSend(NetLibNum, SocketRef, buffer, StrLen(buffer),
netIOFlagOutOfBand,
(NetSocketAddrType *) &sockAddrP, sockAddrPLen, timeout, &err);
bytesReceived = NetLibReceive(NetLibNum, SocketRef, &bufferIN[index],
RECV_BUFFER-index, 0,
(NetSocketAddrType *) &sockAddrP, &sockAddrPlenMine, timeout, &err);
As soon as I do this last call, I get a -1 in bytesReceived an nothing in
bufferIN.
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Friday, June 08, 2001 5:08 PM
Subject: Re: Problems sending an HTTP header to a Web Server
>
> The "Host:" header is required by HTTP/1.1, and is for differentiating
> "between internally-ambiguous URLs, such as the root "/"
> URL of a server for multiple host names on a single IP address,"
> according to RFC 2616.
>
> I agree that 2 new-lines should suffice. In fact, if I understand section
> 4.1 of the RFC, a CRLF is forbidden.
>
> -- Michael
>
>
>
>
>
> "Steve Mann" <[EMAIL PROTECTED]>@news.palmos.com on 06/08/2001 10:51:15 AM
>
> Please respond to "Palm Developer Forum" <[EMAIL PROTECTED]>
>
> Sent by: [EMAIL PROTECTED]
>
>
> To: "Palm Developer Forum" <[EMAIL PROTECTED]>
> cc:
>
> Subject: Re: Problems sending an HTTP header to a Web Server
>
>
> >But when I send the same to a Web server,
> >after sending the data (GET /prueba.html HTTP/1.0\r\n\r\n) when I am
> trying
> >to receive something the sockets is closed and I get nothing.
>
> I find that I only need newline, not return characters:
>
> GET /prueba.html HTTP/1.0\n\n
>
> I've also found that some servers want a "Host:" header (I don't
> think this is an HTTP convention), even though you're connected to a
> specific host via the socket open:
>
> GET /prueba.html HTTP/1.0\nHost:www.hostname.com\n\n
>
> Regards,
> Steve Mann
> --
> -------------------------------------------
> Creative Digital Publishing Inc.
> 1315 Palm Street, San Luis Obispo, CA 93401-3117
> -------------------------------------------
> 805.784.9461 805.784.9462 (fax)
> [EMAIL PROTECTED] http://www.cdpubs.com
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/tech/support/forums/
>
>
>
>
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/