blob: 4c1a32f7960b688e989c52c18467069476191e82 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip_icmp.h>
#include <arpa/inet.h>
#include <unistd.h>
#include "icmp_client.h"
#include "util.h"
int main(void) {
int sock = icmp_client_open_socket();
if (sock < 0) {
perror("icmp_client_open_socket");
return 1;
}
const char *ip_address = "127.0.0.1";
// const char *ip_address = "192.168.43.220";
// const char *ip_address = "198.211.118.67"; // tomsmeding.com
struct icmp_client_incoming reply =
icmp_client_communicate(sock, ip_address, 42, 1234, "kaashandel", 10);
if (reply.data == NULL) {
perror("icmp_client_communicate");
return 1;
}
printf("Received length: %zd payload:\n", reply.length);
xxd(reply.data, reply.length);
}
|