Rev 9620 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9620 | Rev 9766 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #include |
1 | #include |
2 | #include |
- | |
3 | #include |
2 | #include |
4 | #include |
3 | #include |
- | 4 | #include |
|
Line 5... | Line 5... | ||
5 | 5 | ||
- | 6 | int main() |
|
6 | int main() { |
7 | { |
7 | char *host = "kolibrios.org"; |
8 | char* host = "kolibrios.org"; |
8 | int port = 80; |
9 | int port = 80; |
9 | printf("Connecting to %s on port %d\n", host, port); |
10 | printf("Connecting to %s on port %d\n", host, port); |
- | 11 | struct addrinfo* addr_info; |
|
10 | struct addrinfo *addr_info; |
12 | char port_str[16]; |
11 | char port_str[16]; sprintf(port_str, "%d", port); |
13 | sprintf(port_str, "%d", port); |
12 | struct addrinfo hints; |
14 | struct addrinfo hints; |
13 | memset(&hints, 0, sizeof(hints)); |
15 | memset(&hints, 0, sizeof(hints)); |
14 | hints.ai_family = AF_UNSPEC; // IPv4 or IPv6 doesnt matter |
16 | hints.ai_family = AF_UNSPEC; // IPv4 or IPv6 doesnt matter |
15 | hints.ai_socktype = SOCK_STREAM; // TCP stream sockets |
17 | hints.ai_socktype = SOCK_STREAM; // TCP stream sockets |