comparison include/client.h @ 70:f3251851c718

Brought UdpClient files over from ultra-staging branch (with include fix), and updated Makefile accordingly
author andrewm
date Fri, 17 Jul 2015 17:50:54 +0100
parents ad5cd8dd99b3
children
comparison
equal deleted inserted replaced
69:272154649c46 70:f3251851c718
6 #include <netdb.h> 6 #include <netdb.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <unistd.h> 9 #include <unistd.h>
10 #include <string.h> 10 #include <string.h>
11 #include "UdpClient.h"
11 12
12 struct networkData{ 13 struct networkData{
13 int *counter; 14 int *counter;
14 float *variables[16]; 15 float *variables[16];
15 int numVariables; 16 int numVariables;
16 }; 17 };
18 #define NETWORK_AUDIO_BUFFER_SIZE 100 //1400/4 //maximum payload for a UDP datagram over ethernet is 1472 bytes, I leave some headroom and divide by 4 to get the number of floats
19 struct networkAudio{
20 int timestamp;
21 int currentBuffer;
22 int index;
23 float buffers[2][NETWORK_AUDIO_BUFFER_SIZE];
24 int doneOnTime;
25 bool toBeSent;
26 UdpClient udpClient;
27 };
17 28
18 void error(const char *); 29 void error(const char *);
19 int setupSockets(int receivePort, int transmitPort, char const*serverName); 30 int setupSockets(int receivePort, int transmitPort, char const*serverName);
20 int sendMessage(networkData message); 31 int sendMessage(networkData message);
32 int sendAudio(networkAudio *audio);
21 int receiveMessage(networkData message); 33 int receiveMessage(networkData message);
22 void closeSockets(); 34 void closeSockets();