Re: apr_send() -> how to flush to network?

2001-04-08 Thread Jeff Trawick
Graham Leggett <[EMAIL PROTECTED]> writes:

> To send the "HTTP/1.1 200 Connection Established" the code uses
> apr_send() -> but this data is never flushed, so it never sees the
> network (a sniff shows nothing over the wire). As a result the
> connections hangs there and the browser never responds.

A couple of points...

. apr_send() hands the data straight to the TCP/IP stack; it does not
  buffer data, so there is no need for apr_socket_flush()

. if your APR socket has a timeout set or is non-blocking, apr_send()
  can write fewer bytes than you requested... check the output
  bytes-written status

If no bytes are going to the wire, what is happening in the TCP layer?
Can you use netstat to display info about the TCP connection?  Maybe
there are already bytes in the send buffer and the TCP stack can't
accept any more because the other side isn't acknowledging bytes
already sent?

-- 
Jeff Trawick | [EMAIL PROTECTED] | PGP public key at web site:
   http://www.geocities.com/SiliconValley/Park/9289/
 Born in Roswell... married an alien...


out for a while... apr/test builds broken :(

2001-04-08 Thread Jeff Trawick
FYI... I'm about to leave for the airport and will be off-line until
next weekend.

apr/test builds are broken and I have no time to fix.  I guess Justin
and I are co-conspirators (but not 100% sure :) ).

test]$ make
make[1]: Entering directory `/home/trawick/apache/httpd-2.0/srclib/apr/test'
/bin/sh /home/trawick/apache/httpd-2.0/srclib/apr/libtool --mode=compile 
--silent gcc -DLINUX=2  -D_REENTRANT -g -g -O2 -pthread  -I../include  
-I../include -c client.c && touch client.lo
/bin/sh /home/trawick/apache/httpd-2.0/srclib/apr/libtool --mode=link --silent 
gcc -DLINUX=2  -D_REENTRANT -g -g -O2 -pthread  -I../include  -I../include  -o 
client -rpath  $objects client.lo ../libapr.la ../shmem/unix/mm/libmm.la -lm 
-lcrypt -lnsl  -ldl
libtool: link: only absolute run-paths are allowed
make[1]: *** [client] Error 1
make[1]: Leaving directory `/home/trawick/apache/httpd-2.0/srclib/apr/test'
make: *** [all-recursive] Error 1 
-- 
Jeff Trawick | [EMAIL PROTECTED] | PGP public key at web site:
   http://www.geocities.com/SiliconValley/Park/9289/
 Born in Roswell... married an alien...


Re: apr_send() -> how to flush to network?

2001-04-08 Thread Graham Leggett
Jeff Trawick wrote:

> . apr_send() hands the data straight to the TCP/IP stack; it does not
>   buffer data, so there is no need for apr_socket_flush()

Ok.

> . if your APR socket has a timeout set or is non-blocking, apr_send()
>   can write fewer bytes than you requested... check the output
>   bytes-written status
> 
> If no bytes are going to the wire, what is happening in the TCP layer?
> Can you use netstat to display info about the TCP connection?  Maybe
> there are already bytes in the send buffer and the TCP stack can't
> accept any more because the other side isn't acknowledging bytes
> already sent?

A check with netstat shows:

Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address   Foreign Address
State
tcp0 41 cbs53-01-p87.wc.sa:1777 atlas.thawte.com:https 
CLOSE

which is rather odd - the connection is set up using
apr_socket_create(), then opened with apr_connect(), then sent to with
apr_send(). Is this the correct sequence of events? Why the CLOSE?

Regards,
Graham
-- 
-
[EMAIL PROTECTED]   "There's a moon
over Bourbon Street
tonight..."


Re: apr_send() -> how to flush to network?

2001-04-08 Thread Graham Leggett
Jeff Trawick wrote:

> If no bytes are going to the wire, what is happening in the TCP layer?
> Can you use netstat to display info about the TCP connection?  Maybe
> there are already bytes in the send buffer and the TCP stack can't
> accept any more because the other side isn't acknowledging bytes
> already sent?

As it turned out the code I was working on was way more broken than I
thought - many of the sockets were the wrong way round (client and
proxy), which meant the entire thing was hosed. Fixed the sockets, the
thing started working! :)

Regards,
Graham
-- 
-
[EMAIL PROTECTED]   "There's a moon
over Bourbon Street
tonight..."