tcpsocket.h

Go to the documentation of this file.
00001 /* TCP socket class.
00002  *
00003  * PegSoft sockets library (c) 2007 PegSoft
00004  * Contact us at pegsoft@pegsoft.net
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program (see the file COPYING); if not, write to the
00018  * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  */
00020 
00024 #ifndef SOCKETS_TCPSOCKET_H
00025 #define SOCKETS_TCPSOCKET_H
00026 
00027 /*************************************************************************/
00028 
00029 #include <sockets/tcpclient.h>
00030 
00031 /*************************************************************************/
00032 
00033 namespace sockets
00034 {
00035 
00036 /*************************************************************************/
00037 
00039 
00041 class TCPSocket : public TCPClient
00042 {
00043     public:
00045 
00052         explicit TCPSocket(Buffer *rbuf = 0, Buffer *wbuf = 0) :
00053                 TCPClient(rbuf, wbuf), m_next(0) { }
00055         TCPSocket(TCPSocket const &tcps) : TCPClient(tcps), m_next(0) { }
00057         TCPSocket &operator=(TCPSocket const &right);
00058         
00060 
00079         virtual bool connect();
00080         
00082 
00103         virtual bool connect_next(bool *last = 0);
00104         
00106         virtual bool set_remote(char const *address, char const *port,
00107                 char const **error = 0);
00109         virtual bool set_remote(char const *address, unsigned short port,
00110                 char const **error = 0) 
00111                 { return TCPClient::set_remote(address, port, error); }
00112         
00114 
00132         virtual bool add_remote(char const *address, char const *port,
00133                 char const **error = 0);
00134         
00136         virtual char const *raddress() const;
00137         
00139         virtual unsigned short rport() const;
00140     protected:
00142         virtual bool connect(IPInfo const *ipi);
00143         
00145         IPInfo const *next() const { return m_next; }
00146     private:
00147         IPInfo const *m_next;
00148 };
00149 
00150 /*************************************************************************/
00151 
00152 } /* namespace sockets */
00153 
00154 /*************************************************************************/
00155 
00156 #endif /* SOCKETS_TCPSOCKET_H */

Generated on Sun May 20 21:32:15 2007 for Epona API by  doxygen 1.4.6