On Tue, 25 Jun 2002, jean-frederic clere wrote:

> GOMEZ Henri wrote:
> > I allways use read/write on Unix instead of recv/send.
> > It works way better.
> 
> Why better?
> recv/send on BS2000 goes directly to the network through the socket libraries 
> and read/write does with an additional POSIX layer.

My problem was the error handling - my man says " No indication of failure 
to deliver is implicit in a send". 

It now seems write() is not detecting the failure to deliver very well 
either - so we could probably use send as well.

In case a tomcat is restarted we detect the failure only on recv/read - 
and that creates problems with recovery if POST were made ( well, 
there is still a bug in the area, I'm working on it ).

Costin

> 
> 
> > 
> > -
> > Henri Gomez                 ___[_]____
> > EMAIL : [EMAIL PROTECTED]        (. .)                     
> > PGP KEY : 697ECEDD    ...oOOo..(_)..oOOo...
> > PGP Fingerprint : 9DF8 1EA8 ED53 2F39 DC9B 904A 364F 80E6 
> > 
> > 
> > 
> > 
> >>-----Original Message-----
> >>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> >>Sent: Sunday, June 23, 2002 8:56 AM
> >>To: [EMAIL PROTECTED]
> >>Subject: cvs commit: jakarta-tomcat-connectors/jk/native2/common
> >>jk_channel_socket.c
> >>
> >>
> >>mturk       2002/06/22 23:55:56
> >>
> >> Modified:    jk/native2/common jk_channel_socket.c
> >> Log:
> >> Costin changed it to use read/write instead of send/receive.
> >> Unfortunaly that doesn't work on WIN32 cause read/write 
> >>cannot operate on sockets.
> >> Perhaps we shoud reverse that unless there is a strong 
> >>reason to use the
> >> read/write on unix.
> >> 
> >> Revision  Changes    Path
> >> 1.35      +20 -2     
> >>jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c
> >> 
> >> Index: jk_channel_socket.c
> >> ===================================================================
> >> RCS file: 
> >>/home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channe
> >>l_socket.c,v
> >> retrieving revision 1.34
> >> retrieving revision 1.35
> >> diff -u -r1.34 -r1.35
> >> --- jk_channel_socket.c    20 Jun 2002 18:45:01 -0000      1.34
> >> +++ jk_channel_socket.c    23 Jun 2002 06:55:55 -0000      1.35
> >> @@ -355,9 +355,13 @@
> >>      len=msg->len;
> >>      b=msg->buf;
> >>  
> >> -    
> >> +
> >>      while(sent < len) {
> >> +#ifdef WIN32
> >> +        int this_time = send(sd, (char *)b + sent , len - sent, 0);
> >> +#else
> >>          int this_time = write(sd, (char *)b + sent , len - sent);
> >> +#endif
> >>    if(0 == this_time) {
> >>        return -2;
> >>    }
> >> @@ -393,9 +397,16 @@
> >>      if( sd<0 ) return JK_ERR;
> >>      
> >>      while(rdlen < len) {
> >> +#ifdef WIN32
> >> +  /* WIN32 read cannot operate on sockets */
> >> +  int this_time = recv(sd, 
> >> +                       (char *)b + rdlen, 
> >> +                       len - rdlen, 0);   
> >> +#else
> >>    int this_time = read(sd, 
> >>                         (char *)b + rdlen, 
> >>                         len - rdlen);      
> >> +#endif
> >>    if(-1 == this_time) {
> >>  #ifdef WIN32
> >>        if(SOCKET_ERROR == this_time) { 
> >> @@ -430,9 +441,16 @@
> >>      if( sd<0 ) return JK_ERR;
> >>      
> >>      while(rdlen < minLen ) {
> >> +#ifdef WIN32
> >> +  /* WIN32 read cannot operate on sockets */
> >> +  int this_time = recv(sd, 
> >> +                       (char *)b + rdlen, 
> >> +                       maxLen - rdlen, 0);        
> >> +#else
> >>    int this_time = read(sd, 
> >>                         (char *)b + rdlen, 
> >> -                       maxLen - rdlen);
> >> +                       maxLen - rdlen);   
> >> +#endif
> >>  /*         fprintf(stderr, "XXX received %d\n", this_time ); */
> >>    if(-1 == this_time) {
> >>  #ifdef WIN32
> >> 
> >> 
> >> 
> >>
> >>--
> >>To unsubscribe, e-mail:   
> > 
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> > 
> > 
> > --
> > To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> > 
> > 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 
> 


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to