Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
UdpClient.h
1 #pragma once
2 #include <sys/types.h>
3 #include <netinet/in.h>
4 
5 class UdpClient{
6  private:
7  int port;
8  int outSocket;
9  struct timeval stTimeOut;
10  fd_set stWriteFDS;
11  bool enabled = false;
12  bool isSetPort = false;
13  bool isSetServer = false;
14  struct sockaddr_in destinationServer;
15  public:
16  UdpClient();
17  UdpClient(int aPort, const char* aServerName);
18  ~UdpClient();
19  bool setup(int aPort, const char* aServerName);
20  void cleanup();
27  void setPort(int aPort);
28 
35  void setServer(const char* aServerName);
36 
45  int send(void* message, int size);
46 
47  int write(const char* remoteHostname, int remotePortNumber, void* sourceBuffer, int numBytesToWrite);
48  int waitUntilReady(bool readyForReading, int timeoutMsecs);
49  int setSocketBroadcast(int broadcastEnable);
50 };
void setPort(int aPort)
Definition: UdpClient.cpp:37
void cleanup(BelaContext *context, void *userData)
User-defined cleanup function which runs when the program finishes.
Definition: render.cpp:96
bool setup(BelaContext *context, void *userData)
User-defined initialisation function which runs before audio rendering begins.
Definition: render.cpp:51
int send(void *message, int size)
Definition: UdpClient.cpp:55
Definition: UdpClient.h:5
void setServer(const char *aServerName)
Definition: UdpClient.cpp:47