Menu

bug underflow tcpstream retry

Help
Anonymous
2001-06-01
2001-06-07
  • Anonymous

    Anonymous - 2001-06-01

    As my previous reply statement any call made via the Readline() (for now) or a iostream will block if the sender dont close the connection or send a delimeter that we look for, expample getline() even if you specified

        if (ispending(SOCKET_INPUT_TIMEOUT, 1000)
              myTcpStream.getline(buffer, buffersize)

    the problem is the istream calls underflow when he reach the end of get buffer which is ok.  But in the underflow it remakes a calls to recv() which block.

    so my suggestion.

    a public method setTimeout(myTimeout)
    in the underflow

          if (rlen)
               if (ispending(SOCKET_INPUT_TIMEOUT, ..)
                    rlen =  recv(...)
               else
                    rlen = -1
          end if

    so because, the logic behind a stream is to have an abstraction of the primitive of the socket. so now to make a call to a tcpstream it will lokk

    myTcpStream.setTimeout(myTimeOut)

    myTcpStream.getline(buffer, bufferSize)
    myTcpStream.getLine(buffer, bufferSize)...
    etc... whitout calling isPending each time.

    secondo in underflow() while putting the state of stream to failbit the errid should updated.

            Error(SOCKET_INPUIT_ERROR)

    marco           

     
    • David Sugar

      David Sugar - 2001-06-07

      I think this suggestion is essentially correct.  I will look into an implimentation based on what you outline here, unless you have a patch to send already.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.