forked from sunlggggg/netmap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.c
More file actions
24 lines (19 loc) · 612 Bytes
/
Copy pathutil.c
File metadata and controls
24 lines (19 loc) · 612 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
void test() {
printf("%s", "hello world\n");
}
struct sockaddr_in create_address(char *server_ip, int port) {
struct sockaddr_in serv_addr;
memset(&serv_addr, 0, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = inet_addr(server_ip);
serv_addr.sin_port = htons(port);
return serv_addr;
}
void reset(struct sockaddr_in server_address, int fd) {
server_address.sin_family = AF_UNSPEC;
connect(fd, (struct sockaddr *) &server_address, sizeof(server_address));
}