diff --git a/librte_anssock/include/anssock_intf.h b/librte_anssock/include/anssock_intf.h index 2c50ee2..4b7bcf7 100644 --- a/librte_anssock/include/anssock_intf.h +++ b/librte_anssock/include/anssock_intf.h @@ -109,7 +109,7 @@ int anssock_bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen); * @param sockfd * @param buf * @param len - * @param flags + * @param flags: don't support MSG_OOB * @param dest_addr * @param addrlen * @@ -127,7 +127,7 @@ ssize_t anssock_sendto(int sockfd, const void *buf, size_t len, int flags, * @param sockfd * @param buf * @param len - * @param flags + * @param flags: don't support MSG_OOB * * @return * On success, these calls return the number of characters sent. On error, -1 is returned, and errno is set appropriately. diff --git a/test/dpdk_tcp_client/dpdk_tcp_client.c b/test/dpdk_tcp_client/dpdk_tcp_client.c index 4601fb1..fb29e56 100644 --- a/test/dpdk_tcp_client/dpdk_tcp_client.c +++ b/test/dpdk_tcp_client/dpdk_tcp_client.c @@ -216,7 +216,7 @@ int main(void) remote_addr.sin_port = htons(8000); remote_addr.sin_addr.s_addr = inet_addr("10.0.0.10"); ; - if(anssock_connect(fd[i], (struct sockaddr *)&remote_addr, sizeof(struct sockaddr)) < 0) + if(anssock_connect(fd[i], (struct sockaddr *)&remote_addr, sizeof(struct sockaddr)) < 0 && errno != EINPROGRESS) { printf("connect to server failed \n"); anssock_close(fd[i]); @@ -288,14 +288,20 @@ int main(void) recv_len = anssock_recvfrom(events[i].data.fd, recv_buf, 5000, 0, NULL, NULL); if((recv_len < 0) && (errno == ANS_EAGAIN)) { - // printf("no data in socket \n"); + // printf("no data in socket \n"); break; } - else if(recv_len < 0) + else if(recv_len <= 0) { // socket error - //anssock_close(fd); + printf("socket error \n"); + anssock_close(events[i].data.fd); + for(j = 0; j < TCP_CLIENT_NB; j++) + { + if(fd[j] == events[i].data.fd) + fd[j] = -1; + } break; }