Mercurial > hg > beaglert
annotate include/UdpClient.h @ 44:f5b5c648cd5d ultra-staging
- added (unused) simple c++ classes for udp datagrams\n- added tests for the new classes
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Wed, 20 May 2015 18:07:16 +0100 |
parents | |
children | 6907e2177eb8 |
rev | line source |
---|---|
giuliomoro@44 | 1 /* |
giuliomoro@44 | 2 * udpClient.h |
giuliomoro@44 | 3 * |
giuliomoro@44 | 4 * Created on: 19 May 2015 |
giuliomoro@44 | 5 * Author: giulio moro |
giuliomoro@44 | 6 */ |
giuliomoro@44 | 7 |
giuliomoro@44 | 8 #ifndef UDPCLIENT_H_ |
giuliomoro@44 | 9 #define UDPCLIENT_H_ |
giuliomoro@44 | 10 |
giuliomoro@44 | 11 #include <sys/types.h> |
giuliomoro@44 | 12 #include <sys/socket.h> |
giuliomoro@44 | 13 #include <netinet/in.h> |
giuliomoro@44 | 14 #include <arpa/inet.h> |
giuliomoro@44 | 15 #include <netdb.h> |
giuliomoro@44 | 16 #include <stdio.h> |
giuliomoro@44 | 17 #include <stdlib.h> |
giuliomoro@44 | 18 #include <unistd.h> |
giuliomoro@44 | 19 #include <string.h> |
giuliomoro@44 | 20 |
giuliomoro@44 | 21 class UdpClient{ |
giuliomoro@44 | 22 private: |
giuliomoro@44 | 23 int port; |
giuliomoro@44 | 24 int enabled; |
giuliomoro@44 | 25 int outSocket; |
giuliomoro@44 | 26 struct sockaddr_in destinationServer; |
giuliomoro@44 | 27 public: |
giuliomoro@44 | 28 UdpClient(); |
giuliomoro@44 | 29 UdpClient(int aPort, const char* aServerName); |
giuliomoro@44 | 30 ~UdpClient(); |
giuliomoro@44 | 31 void setPort(int aPort); |
giuliomoro@44 | 32 void setServer(const char* aServerName); |
giuliomoro@44 | 33 int send(void* message, int size); |
giuliomoro@44 | 34 }; |
giuliomoro@44 | 35 |
giuliomoro@44 | 36 |
giuliomoro@44 | 37 |
giuliomoro@44 | 38 #endif /* UDPCLIENT_H_ */ |