char debug[MAXLINE+20];
/* main loop, reading 0 char means client close connection */
while ( (nread = read(sockfd, buffer, MAXLINE)) != 0) {
+ nwrite = FullWrite(sockfd, buffer, nread);
if (debugging) {
- snprintf(debug, MAXLINE+20, "Letti %d bytes, %s\n", nread, buffer);
- debug[strlen(debug)] = 0;
+ buffer[nread] = 0;
+ snprintf(debug, MAXLINE+20, "Letti %d byte, %s", nread, buffer);
if (demonize) { /* go daemon */
syslog(LOG_DEBUG, debug);
} else {
- fputs(debug, stdout);
+ printf("%s", debug);
}
}
- nwrite = FullWrite(sockfd, buffer, nread);
}
return;
}
-/* ElemEchoTCPServer.c
+/* TCP_echod.c
*
- * Copyright (C) 2001 Simone Piccardi
+ * Copyright (C) 2001-2003 Simone Piccardi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* Usage: echod -h give all info
*
- * $Id: TCP_echod.c,v 1.1 2003/05/02 09:50:55 piccardi Exp $
+ * $Id: TCP_echod.c,v 1.2 2003/05/02 10:09:50 piccardi Exp $
*
****************************************************************/
/*