Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages

udp.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                             udp.h  -  UDP sockets
00003                              -------------------
00004     begin                : Sun Jun 1 2003
00005     copyright            : (C) 2003 by Keaton Mullis
00006     email                : kmullis@zianet.com
00007  ***************************************************************************
00008 
00009  The contents of this file are subject to the Mozilla Public License Version
00010  1.1 (the "License"); you may not use this file except in compliance with
00011  the License. You may obtain a copy of the License at 
00012  http://www.mozilla.org/MPL/
00013 
00014  Software distributed under the License is distributed on an "AS IS" basis,
00015  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00016  for the specific language governing rights and limitations under the
00017  License.
00018 
00019  The Original Code is the NeoEngine, udp.h
00020 
00021  The Initial Developer of the Original Code is Keaton Mullis.
00022  Portions created by Keaton Mullis are Copyright (C) 2003
00023  Keaton Mullis. All Rights Reserved.
00024 
00025  ***************************************************************************/
00026 
00027 #ifndef __NEUDP_H
00028 #define __NEUDP_H
00029 
00030 
00031 
00032 #include "base.h"
00033 #include "socket.h"
00034 
00035 #include <string>
00036 
00037 
00043 namespace NeoEngine
00044 {
00045 
00046 
00047 //External classes
00048 class Thread;
00049 
00050 
00051 
00052 
00058 class NEOENGINE_API UDPSocket : public Socket
00059 {
00060     public:
00061 
00063         int                                    m_iSocket;
00064 
00066         std::string                            m_strTargetAddr;
00067 
00069         int                                    m_iTargetPort;
00070 
00074                                                UDPSocket( SocketCallback *pkCallback = 0 );
00075 
00080                                                UDPSocket( int iSocket, SocketCallback *pkCallback = 0 );
00081 
00084         virtual                               ~UDPSocket();
00085 
00092         virtual bool                           Listen( int iPort, SocketCallback *pkCallback );
00093 
00100         virtual bool                           Connect( const std::string &rstrAddr, int iPort );
00101 
00111         int                                    Read( void *pDst, int iBytes, std::string &rstrFromAddr, int &riFromPort );
00112 
00119         int                                    Write( const void *pSrc, int iBytes );
00120 
00124         virtual int                            GetFD() { return m_iSocket; }
00125 
00130         virtual void                           SetBlocking( bool bBlock = false );
00131 
00137         virtual unsigned int                   Poll( int iTimeout );
00138 };
00139 
00140 
00141 }; // namespace NeoEngine
00142 
00143 
00144 
00145 #endif

Generated on Wed Jan 21 14:21:07 2004 for NeoEngine by doxygen 1.3.5