diff --git a/minissdpd/testminissdpd.c b/minissdpd/testminissdpd.c index 5670783..60c5b9b 100644 --- a/minissdpd/testminissdpd.c +++ b/minissdpd/testminissdpd.c @@ -5,6 +5,8 @@ * copyright (c) 2005-2014 Thomas Bernard * This software is subjet to the conditions detailed in the * provided LICENCE file. */ +#include "config.h" + #include #include #include @@ -92,10 +94,14 @@ main(int argc, char * * argv) char overflow[] = { 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; int s; int i; - unsigned char buf[16*1024]; + unsigned char buf[RESPONSE_BUFFER_SIZE]; + unsigned char chunk[4096]; ssize_t n; + int total = 0; const char * sockpath = "/var/run/minissdpd.sock"; + printf("Response buffer size %d bytes\n", (int)RESPONSE_BUFFER_SIZE); + for(i=0; i 0) { + memcpy(buf + total, chunk, n); + total += n; + } + break; + } + + memcpy(buf + total, chunk, n); + total += n; + n = read(s, chunk, sizeof(chunk)); + printf("response received %d bytes\n", (int)n); + } + printresponse(buf, total); if(n == 0) { close(s); s = connect_unix_socket(sockpath); @@ -151,4 +173,3 @@ main(int argc, char * * argv) close(s); return 0; } -