Hi,
        I am trying to use the Internet Library(INet.Lib) to communicate
with a remote machine.    

        I am able to create a HTTP request, send it to the remote machine
and read the response correctly once.  But when I try to create a second
request and send it I am getting an error in the second
INetLibHTTPReqSend.  The error no is 5130 which corresponds to 
INVALID REQUEST.  I am not able to figure out why the same request is
valid the first time and invalid subsequently.  

        However, when I close the socket and reopen it again everything
works fine.

        Does anyone know what the problem is? (I have included the code
below)

thanks
Arvind
[EMAIL PROTECTED]
Stanford University.

----------------------------------------------------------------------
        Err                                     error;
        UInt                                    refNum;
        INetConfigNameType                      cName;
        Handle                                  inetHandle;
        Word                                    index;
        Handle                                  sockHandle;
        char                                    buf[100];
        DWord                                   read;

        // Open the library and the socket
        error = SysLibFind("INet.lib", &refNum);
        StrCopy(cName.name, inetCfgNameCTPDefault);
        error = INetLibConfigIndexFromName(refNum, &cName,&index);
        error = INetLibOpen(refNum, index, 0, NULL, 0, &inetHandle);
        error = INetLibSockOpen(refNum, inetHandle, inetSchemeHTTP, 
                                &sockHandle);

        // connect the socket
        error = INetLibSockConnect(refNum, sockHandle, 
                                        (BytePtr) "www.stanford.edu", 80,-1);

        // create, send a HTTP request and receive the response
        error = INetLibSockHTTPReqCreate(refNum, sockHandle, 
                        (BytePtr)"GET",
                        (BytePtr)"http://www.stanford.edu/~arvinda/palm.html",
                        NULL);  
        error = INetLibSockHTTPReqSend(refNum, sockHandle, NULL, 0, -1);~       
        error = INetLibSockRead(refNum, sockHandle, (VoidPtr) buf,
                                60, &read, -1);

        // create and send a second HTTP request
        error = INetLibSockHTTPReqCreate(refNum, sockHandle, 
                        (BytePtr)"GET",
                        (BytePtr)"http://www.stanford.edu/~arvinda/palm.html",
                        NULL);
        error = INetLibSockHTTPReqSend(refNum, sockHandle, NULL, 0, -1);
        error = INetLibSockRead(refNum, sockHandle, (VoidPtr) buf,
                        60, &read, -1);

Reply via email to