Mercurial > hg > beaglert
annotate include/UdpClient.h @ 53:6907e2177eb8 ultra-staging
Fixed bugs in Udp classes, updated tests
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Sun, 07 Jun 2015 14:58:34 +0100 |
parents | f5b5c648cd5d |
children | 3068421c0737 |
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@53 | 26 bool isSetPort; |
giuliomoro@53 | 27 bool isSetServer; |
giuliomoro@44 | 28 struct sockaddr_in destinationServer; |
giuliomoro@44 | 29 public: |
giuliomoro@44 | 30 UdpClient(); |
giuliomoro@44 | 31 UdpClient(int aPort, const char* aServerName); |
giuliomoro@44 | 32 ~UdpClient(); |
giuliomoro@44 | 33 void setPort(int aPort); |
giuliomoro@44 | 34 void setServer(const char* aServerName); |
giuliomoro@44 | 35 int send(void* message, int size); |
giuliomoro@44 | 36 }; |
giuliomoro@44 | 37 |
giuliomoro@44 | 38 |
giuliomoro@44 | 39 |
giuliomoro@44 | 40 #endif /* UDPCLIENT_H_ */ |