[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

http_url_post speed concerns



Sender: "Bartell, Aaron L. (TC)" <ALBartell@xxxxxxxxxxxxxx>

I have a program making use of the http_url_post sub proc from the HTTP
API's and have some concerns about speed. I have gone through the code and
have a question as to why only one byte of data is being read from the
socket connection at a time?  Take a look at this line of code "eval
wwRec = recv(peSock: wwPos: 1: 0)".

Any clarification is welcome. . .

Aaron Bartell

- HTTPAPIR4(*Module)
  - recvresp (sub proc)

     c                   dow       forever

     C* get 1 byte of data

     c                   eval      wwRec = recv(peSock: wwPos: 1: 0)

 

     c                   if        wwRec = 0

     c                   callp     SetError(HTTP_RRRECV:'recvresp: recv():
'+                       
     c                                  ' socket was shutdown for reading')

     c                   return    -1

     c                   endif

 

     C* if we didn't get any data, and theres an error, return it:

     c                   if        wwRec < 0

 

     c                   eval      wwErr = errno

     c                   if        wwErr <> EAGAIN

     c                   callp     SetError(HTTP_RRRECV:'recvresp: recv():
'+                       
     c                                   %str(strerror(wwErr)) )

     c                   return    -1

     c                   endif

 

     C* if we didn't get any data, stop and wait for some:

     c                   eval      p_saveaddr = p_timeval

     c                   eval      p_timeval = %addr(wwTimeout)

     c                   eval      tv_sec = peTimeout

     c                   eval      tv_usec = 0

     c                   eval      p_timeval = p_saveaddr

 

     c                   callp     FD_ZERO(wwfds)

     c                   callp     FD_SET(peSock: wwfds)

 

     c                   if        select(peSock+1:%addr(wwfds):*NULL:*NULL:

     c                               %addr(wwTimeout)) < 0

     c                   callp     SetError(HTTP_RRSELE:'recvresp: ' +

     c                               'select: '+%str(strerror(wwErr)) )

     c                   return    -1

     c                   endif

 

     C* ugggh! we timed out!

     c                   if        FD_ISSET(peSock: wwfds) = *Off

     c                   return    0

     c                   endif

 

     c                   iter

     c                   endif

 

     C* increase count of chars received.  Don't let it overflow.

     c                   eval      wwLen = wwLen + 1

     c                   if        wwLen = peRespLen

     c                   leave

     c                   endif

 

     C* check for end of response chain:

     c                   if        wwLen > 3

     c                   eval      p_check = wwPos - 3

     c                   if        wwCheck = x'0d0a0d0a'

     c                   leave

     c                   endif

     c                   endif

 

     c                   eval      wwPos = wwPos + 1

     c                   enddo 
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------