DatagramSocket.h++

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------
00002    commonc++ - A C++ Common Class Library
00003    Copyright (C) 2005-2012  Mark A Lindner
00004 
00005    This file is part of commonc++.
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License as published by the Free Software Foundation; either
00010    version 2 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Library General Public License for more details.
00016 
00017    You should have received a copy of the GNU Library General Public
00018    License along with this library; if not, write to the Free
00019    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020    ---------------------------------------------------------------------------
00021 */
00022 
00023 #ifndef __ccxx_DatagramSocket_hxx
00024 #define __ccxx_DatagramSocket_hxx
00025 
00026 #include <commonc++/Common.h++>
00027 #include <commonc++/Buffer.h++>
00028 #include <commonc++/IOException.h++>
00029 #include <commonc++/Socket.h++>
00030 #include <commonc++/SocketAddress.h++>
00031 
00032 namespace ccxx {
00033 
00043 class COMMONCPP_API DatagramSocket : public Socket
00044 {
00045 
00046   public:
00047 
00053   DatagramSocket(uint16_t port = 0) throw();
00054 
00056   ~DatagramSocket() throw();
00057 
00068   void connect(const String &addr, uint16_t port) throw(IOException);
00069 
00078   void connect(const SocketAddress &addr) throw(IOException);
00079 
00088   size_t send(const byte_t *buffer, size_t buflen) throw(IOException);
00089 
00097   size_t send(ByteBuffer& buffer) throw(IOException);
00098 
00107   size_t send(const byte_t *buffer, size_t buflen, const SocketAddress& dest)
00108     throw(IOException);
00109 
00117   size_t send(ByteBuffer& buffer, const SocketAddress& dest)
00118     throw(IOException);
00119 
00128   size_t receive(byte_t *buffer, size_t buflen) throw(IOException);
00129 
00137   size_t receive(ByteBuffer& buffer) throw(IOException);
00138 
00148   size_t receive(byte_t *buffer, size_t buflen, SocketAddress& source)
00149     throw(IOException);
00150 
00159   size_t receive(ByteBuffer& buffer, SocketAddress& source)
00160     throw(IOException);
00161 
00170   void setBroadcast(bool flag) throw(SocketException);
00171 
00177   bool getBroadcast() const throw(SocketException);
00178 
00180   static const size_t MAX_DATAGRAM_SIZE;
00181 
00182   private:
00183 
00184   CCXX_COPY_DECLS(DatagramSocket);
00185 };
00186 
00187 }; // namespace ccxx
00188 
00189 #endif // __ccxx_DatagramSocket_hxx
00190 
00191 /* end of header file */
Generated on Sat Nov 26 16:49:07 2011 for libcommonc++ by  doxygen 1.6.3