Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions tests/extra_api/server_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
Expand Down Expand Up @@ -133,15 +134,17 @@ static int _tcp_create_and_bind(struct sockaddr_in *addr)
int fd;
int flag;

fd = socket(PF_INET, SOCK_STREAM, IPPROTO_IP);
fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (!fd) {
rc = -EBUSY;
printf("Failed to create socket\n");
goto err;
}

#if defined(IB_DEV)
rc = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, (void *)IB_DEV, strlen(IB_DEV));
struct ifreq ifr = {};
strncpy(ifr.ifr_name, IB_DEV, IFNAMSIZ);
rc = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, (void *)&ifr, sizeof(ifr));
if (rc < 0) {
printf("Failed to setsockopt(SO_BINDTODEVICE) for %s: %s\n", IB_DEV, strerror(errno));
exit(1);
Expand Down Expand Up @@ -245,7 +248,7 @@ int main(int argc, char *argv[])
token2 = strtok(NULL, s);

memset(&addr, 0, sizeof(addr));
addr.sin_family = PF_INET;
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = inet_addr(token1);
addr.sin_port = htons(atoi(token2));
sfd[i] = _tcp_create_and_bind(&addr);
Expand Down Expand Up @@ -345,7 +348,7 @@ int main(int argc, char *argv[])
/* Step:6 Process data */
if (event & EPOLLIN) {
#if defined(XLIO_API) && (XLIO_API == 1)
printf("xlio_comps[j].packet.num_bufs equal to %d \n",
printf("xlio_comps[j].packet.num_bufs equal to %lu \n",
xlio_comps[j].packet.num_bufs);
assert(1 == xlio_comps[j].packet.num_bufs);
assert(sizeof(conns.msg) > xlio_comps[j].packet.total_len);
Expand Down