[PATCH 1/5] The ugly fix.

From: David Favro
Date: Mon Jun 14 2010 - 19:30:02 EST


---
test-dude-webserver/test-webserver.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/test-dude-webserver/test-webserver.c b/test-dude-webserver/test-webserver.c
index 0462a88..f3e9734 100644
--- a/test-dude-webserver/test-webserver.c
+++ b/test-dude-webserver/test-webserver.c
@@ -7,6 +7,9 @@
#include <string.h>
#include <time.h>
#include <netinet/tcp.h>
+#include <sys/ioctl.h>
+#include <asm/ioctls.h> // TIOCOUTQ (SIOCOUTQ)
+#include <linux/sockios.h> // SIOCOUTQ

#define ROOTPATH "/root/htmldocs" //just for testing, I'll change later

@@ -110,6 +113,19 @@ int main(int argc, char *argv[])
if (sbytes != rbytes) printf("%d\n", sbytes); //just for debugging purposes
}
close(file);
+ for ( ; ; )
+ {
+ int value;
+ if ( ioctl(newsockfd, SIOCOUTQ, &value) < 0 )
+ error("ioctl(SIOCOUTQ) failed");
+ if ( value > 0 )
+ {
+ printf( "%d bytes left to send.\n", value );
+ sleep(1);
+ }
+ else
+ break;
+ }
close(newsockfd);
}
return 0;
--
1.6.3.3


--------------010909060201050408020402--
--
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html