Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Files Functions Variables Typedefs Macros Groups
UdpClient.h
1 /*
2  * udpClient.h
3  *
4  * Created on: 19 May 2015
5  * Author: giulio moro
6  */
7 
8 #ifndef UDPCLIENT_H_
9 #define UDPCLIENT_H_
10 
11 #include <sys/types.h>
12 #include <sys/socket.h>
13 #include <netinet/in.h>
14 #include <arpa/inet.h>
15 #include <netdb.h>
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <unistd.h>
19 #include <string.h>
20 
21 class UdpClient{
22  private:
23  int port;
24  int enabled;
25  int outSocket;
26  struct timeval stTimeOut;
27  fd_set stWriteFDS;
28  bool isSetPort;
29  bool isSetServer;
30  struct sockaddr_in destinationServer;
31  public:
32  UdpClient();
33  UdpClient(int aPort, const char* aServerName);
34  ~UdpClient();
41  void setPort(int aPort);
42 
49  void setServer(const char* aServerName);
50 
59  int send(void* message, int size);
60 
61  int write(const char* remoteHostname, int remotePortNumber, void* sourceBuffer, int numBytesToWrite);
62  int waitUntilReady(bool readyForReading, int timeoutMsecs);
63  int setSocketBroadcast(int broadcastEnable);
64 };
65 
66 
67 
68 #endif /* UDPCLIENT_H_ */
void setPort(int aPort)
int send(void *message, int size)
Definition: UdpClient.h:21
void setServer(const char *aServerName)