Browse code

added send error handling

Jiri Kuthan authored on 12/11/2001 22:53:41
Showing 1 changed files
... ...
@@ -173,7 +173,10 @@ int main (int argc, char** argv)
173 173
 	/* flood loop */
174 174
 	for (r=0; r<count; r++){
175 175
 		if ((verbose>1)&&(r%1000))  putchar('.');
176
-		send(sock, buf, n, 0);
176
+		if (send(sock, buf, n, 0)==-1) {
177
+			fprintf(stderr, "Error: send: %s\n",  strerror(errno));
178
+			exit(1);
179
+		}
177 180
 	}
178 181
 	printf("\n%d packets sent, %d bytes each => total %d bytes\n",
179 182
 			count, n, n*count);