view include/UdpClient.h @ 125:850a4a9bd832 scope-refactoring

Added ifdefs and unified the code with udpioplugin ... the latter has not been tested (or committed). TODO: still it hangs after ctrl-c BeagleRT (auxiliary tasks do not terminate). TODO: sometimes you can hear dropouts in the transmission. Maybe it is due to pointer drifting. Rebooting BBB fixes/affects this issue.
author Giulio Moro <giuliomoro@yahoo.it>
date Sat, 22 Aug 2015 02:53:36 +0100
parents 3068421c0737
children da1c61aa97ea
line wrap: on
line source
/*
 * udpClient.h
 *
 *  Created on: 19 May 2015
 *      Author: giulio moro
 */

#ifndef UDPCLIENT_H_
#define UDPCLIENT_H_

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

class UdpClient{
	private:
		int port;
		int enabled;
		int outSocket;
		bool isSetPort;
		bool isSetServer;
		struct sockaddr_in destinationServer;
	public:
		UdpClient();
		UdpClient(int aPort, const char* aServerName);
		~UdpClient();
		void setPort(int aPort);
		void setServer(const char* aServerName);
		int send(void* message, int size);
};



#endif /* UDPCLIENT_H_ */