-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUDPSender.h
More file actions
40 lines (31 loc) · 700 Bytes
/
UDPSender.h
File metadata and controls
40 lines (31 loc) · 700 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
35
36
37
38
39
40
//
// UDPSender.h
// TabletServer
//
// Created by Timothy Kukulski on 10/22/12.
//
//
#ifndef __TabletServer__UDPSender__
#define __TabletServer__UDPSender__
#include <netdb.h>
class UDPSender {
public:
UDPSender(const char *host, int port);
// virtual ~UDPSender();
void send(void *data, size_t count);
private:
int sockfd;
struct addrinfo hints, *servinfo, *p;
};
class UDPListener {
public:
UDPListener(int port);
void setNonblocking();
// virtual ~UDPListener();
size_t listen(void *data, size_t maxcount);
private:
int sock;
struct sockaddr_in server;
struct sockaddr_in from;
};
#endif /* defined(__TabletServer__UDPSender__) */