Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

UDP.h

00001 /* hey emacs! -*- Mode: C++; c-file-style: "stroustrup"; indent-tabs-mode: nil -*- */
00002 /*
00003  * $Id: UDP.h,v 1.6 2000/12/27 16:59:27 rex Exp $
00004  *
00005  * Copyright (c) 2000 Remi Lefebvre  <remi@dhis.net>
00006  *                and Luca Filipozzi <lfilipoz@dhis.net>
00007  *
00008  * DDT comes with ABSOLUTELY NO WARRANTY and is licenced under the
00009  * GNU General Public License (version 2 or later). This license
00010  * can be retrieved from http://www.gnu.org/copyleft/gnu.html.
00011  *
00012  */
00013 
00014 #ifndef UDP_H
00015 #define UDP_H
00016 
00017 #ifdef HAVE_CONFIG_H
00018 #include "config.h"
00019 #endif
00020 
00021 #include <iostream>
00022 //#include <unistd.h>
00023 //#include <fcntl.h>
00024 #include <netinet/in.h>
00025 
00026 class UDP
00027 {
00028   public:
00029     UDP (unsigned int clientport, unsigned int serverport);   // server constructor
00030     UDP (char *hostaddr, unsigned int clientport, unsigned int serverport); // client constructor
00031     ~UDP ();
00032 
00033     // server
00034     int recv   (void *buf, int bufSize, unsigned long *from);
00035     int sendTo (unsigned long ipAddress, void *buf, int bufSize);
00036 
00037     // client
00038     int send   (void *buf, int bufSize);
00039     
00040   protected:
00041     UDP () { /* hide the default constructor */ };
00042 
00043   private:
00044     unsigned int clientport_;
00045     unsigned int serverport_;
00046 
00047     struct sockaddr_in  server_addr_;
00048     struct sockaddr_in  client_addr_;
00049     bool isClient_;
00050 
00051   public:
00052     int send_sd_;
00053     int recv_sd_;
00054 };
00055 
00056 #endif // UDP_H

Generated on Tue Sep 13 01:32:47 2005 for DDT Project by  doxygen 1.4.4