Changes in uspace/app/netecho/netecho.c [cd22764:92b42442] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/netecho/netecho.c
rcd22764 r92b42442 241 241 /* Accept a socket if a stream socket is used */ 242 242 addrlen = sizeof(address_buf); 243 if (verbose) 244 printf("accept()\n"); 243 245 socket_id = accept(listening_id, (void *) address_buf, &addrlen); 244 246 if (socket_id <= 0) { … … 258 260 259 261 /* Receive a message to echo */ 262 if (verbose) 263 printf("recvfrom()\n"); 260 264 rcv_size = recvfrom(socket_id, data, size, 0, address, 261 265 &addrlen); … … 297 301 298 302 /* Answer the request either with the static reply or the original data */ 299 rc = sendto(socket_id, reply ? reply : data, reply ? reply_length : length, 0, address, addrlen); 300 if (rc != EOK) 301 socket_print_error(stderr, rc, "Socket send: ", "\n"); 303 if (type == SOCK_STREAM) { 304 if (verbose) 305 printf("send()\n"); 306 rc = send(socket_id, reply ? reply : data, reply ? reply_length : length, 0); 307 if (rc != EOK) 308 socket_print_error(stderr, rc, "Socket send: ", "\n"); 309 } else { 310 if (verbose) 311 printf("sendto()\n"); 312 rc = sendto(socket_id, reply ? reply : data, reply ? reply_length : length, 0, address, addrlen); 313 if (rc != EOK) 314 socket_print_error(stderr, rc, "Socket send: ", "\n"); 315 } 302 316 } 303 317 … … 359 373 address_in.sin_family = AF_INET; 360 374 address_in.sin_port = htons(port); 375 address_in.sin_addr.s_addr = INADDR_ANY; 361 376 address = (struct sockaddr *) &address_in; 362 377 addrlen = sizeof(address_in);
Note:
See TracChangeset
for help on using the changeset viewer.