Changeset 7aaed09 in mainline for uspace/app/netecho/netecho.c


Ignore:
Timestamp:
2011-12-18T14:02:30Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c868e2d
Parents:
3b71e84d (diff), 1761268 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/netecho/netecho.c

    r3b71e84d r7aaed09  
    241241                /* Accept a socket if a stream socket is used */
    242242                addrlen = sizeof(address_buf);
     243                if (verbose)
     244                        printf("accept()\n");
    243245                socket_id = accept(listening_id, (void *) address_buf, &addrlen);
    244246                if (socket_id <= 0) {
     
    258260
    259261                /* Receive a message to echo */
     262                if (verbose)
     263                        printf("recvfrom()\n");
    260264                rcv_size = recvfrom(socket_id, data, size, 0, address,
    261265                    &addrlen);
     
    297301
    298302                        /* 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                        }
    302316                }
    303317
Note: See TracChangeset for help on using the changeset viewer.