giuliomoro@24: /* UDP client in the internet domain */ giuliomoro@24: #include giuliomoro@24: #include giuliomoro@24: #include giuliomoro@24: #include giuliomoro@24: #include giuliomoro@24: #include giuliomoro@24: #include giuliomoro@24: #include giuliomoro@24: #include andrewm@70: #include "UdpClient.h" giuliomoro@24: giuliomoro@24: struct networkData{ giuliomoro@24: int *counter; giuliomoro@24: float *variables[16]; giuliomoro@24: int numVariables; giuliomoro@24: }; andrewm@70: #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 andrewm@70: struct networkAudio{ andrewm@70: int timestamp; andrewm@70: int currentBuffer; andrewm@70: int index; andrewm@70: float buffers[2][NETWORK_AUDIO_BUFFER_SIZE]; andrewm@70: int doneOnTime; andrewm@70: bool toBeSent; andrewm@70: UdpClient udpClient; andrewm@70: }; giuliomoro@24: giuliomoro@24: void error(const char *); giuliomoro@24: int setupSockets(int receivePort, int transmitPort, char const*serverName); giuliomoro@24: int sendMessage(networkData message); andrewm@70: int sendAudio(networkAudio *audio); giuliomoro@24: int receiveMessage(networkData message); giuliomoro@24: void closeSockets();