X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=blobdiff_plain;f=test%2Fserver%2Fserver.c;h=317c9a16ef43083771854e5f2d7610ce6cc47c9e;hb=38b4c4d6d866c6077233633d3e7c0850a22fd261;hp=9c1e228696567c82b797e8d7e9f983d812748daa;hpb=4f43366e09852a0d49c2983897290814ce43a80f;p=p2p-kernel-protocol.git diff --git a/test/server/server.c b/test/server/server.c index 9c1e228..317c9a1 100644 --- a/test/server/server.c +++ b/test/server/server.c @@ -43,16 +43,18 @@ int main(int argc, char **argv) printf("Cannot bind to server: %s(%d)\n", strerror(errno), errno); return -1; } - argv += 2; printf("Bound to: %s:%s\n", argv[0], argv[1]); + argv += 2; - err = read(sock, argv[0], sizeof(argv[0])); - if (err < 0) { - printf("Error while receiving file %s: %s(%d)\n", argv[0], - strerror(errno), errno); - return err; - } + do { + err = read(sock, argv[0], sizeof(argv[0])); + if (err < 0) { + printf("Error while receiving file %s: %s(%d)\n", argv[0], + strerror(errno), errno); + return err; + } + } while (err > 0); printf("Successfully read file %s\n", argv[0]);