-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspres.c
More file actions
34 lines (27 loc) · 841 Bytes
/
spres.c
File metadata and controls
34 lines (27 loc) · 841 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
25
26
27
28
29
30
31
32
33
34
//******************************************************************************
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <assert.h>
//******************************************************************************
int main(void)
{
struct sockaddr_in sin =
{
.sin_family = AF_INET,
.sin_port = htons(2342),
.sin_addr = { inet_addr("172.23.42.29") },
};
int sock = socket(sin.sin_family, SOCK_DGRAM, IPPROTO_UDP);
assert(sock >= 0);
static unsigned char cmd[] = "\x00\x0b";
int sent = sendto(sock, cmd, 2, 0, (struct sockaddr *)&sin, sizeof(sin));
assert(sent >= 0);
close(sock);
exit(EXIT_SUCCESS);
}
//******************************************************************************