Changeset d9ce049 in mainline for uspace/srv/net/tl/tcp/test.c


Ignore:
Timestamp:
2011-10-04T20:40:05Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8c7a054
Parents:
32105348
Message:

Implement RECEIVE user call.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/tl/tcp/test.c

    r32105348 rd9ce049  
    4545#include "test.h"
    4646
     47#define RCV_BUF_SIZE 64
     48
    4749static void test_srv(void *arg)
    4850{
    4951        tcp_conn_t *conn;
    5052        tcp_sock_t sock;
     53        char rcv_buf[RCV_BUF_SIZE + 1];
     54        size_t rcvd;
     55        xflags_t xflags;
    5156
    5257        printf("test_srv()\n");
     
    5459        sock.addr.ipv4 = 0x7f000001;
    5560        tcp_uc_open(80, &sock, ap_passive, &conn);
     61
     62        while (true) {
     63                printf("User receive...\n");
     64                tcp_uc_receive(conn, rcv_buf, RCV_BUF_SIZE, &rcvd, &xflags);
     65                rcv_buf[rcvd] = '\0';
     66                printf("User received %zu bytes '%s'.\n", rcvd, rcv_buf);
     67
     68                async_usleep(1000*1000*2);
     69        }
    5670}
    5771
Note: See TracChangeset for help on using the changeset viewer.