PTLib
Version 2.10.4
|
00001 /* 00002 * tcpsock.h 00003 * 00004 * Transmission Control Protocol socket channel class. 00005 * 00006 * Portable Windows Library 00007 * 00008 * Copyright (c) 1993-1998 Equivalence Pty. Ltd. 00009 * 00010 * The contents of this file are subject to the Mozilla Public License 00011 * Version 1.0 (the "License"); you may not use this file except in 00012 * compliance with the License. You may obtain a copy of the License at 00013 * http://www.mozilla.org/MPL/ 00014 * 00015 * Software distributed under the License is distributed on an "AS IS" 00016 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00017 * the License for the specific language governing rights and limitations 00018 * under the License. 00019 * 00020 * The Original Code is Portable Windows Library. 00021 * 00022 * The Initial Developer of the Original Code is Equivalence Pty. Ltd. 00023 * 00024 * Portions are Copyright (C) 1993 Free Software Foundation, Inc. 00025 * All Rights Reserved. 00026 * 00027 * Contributor(s): ______________________________________. 00028 * 00029 * $Revision: 24177 $ 00030 * $Author: rjongbloed $ 00031 * $Date: 2010-04-05 06:52:04 -0500 (Mon, 05 Apr 2010) $ 00032 */ 00033 00034 #ifndef PTLIB_TCPSOCKET_H 00035 #define PTLIB_TCPSOCKET_H 00036 00037 #ifdef P_USE_PRAGMA 00038 #pragma interface 00039 #endif 00040 00041 00044 class PTCPSocket : public PIPSocket 00045 { 00046 PCLASSINFO(PTCPSocket, PIPSocket); 00047 public: 00057 PTCPSocket( 00058 WORD port = 0 00059 ); 00060 PTCPSocket( 00061 const PString & service 00062 ); 00063 PTCPSocket( 00064 const PString & address, 00065 WORD port 00066 ); 00067 PTCPSocket( 00068 const PString & address, 00069 const PString & service 00070 ); 00071 PTCPSocket( 00072 PSocket & socket 00073 ); 00074 PTCPSocket( 00075 PTCPSocket & tcpSocket 00076 ); 00078 00093 virtual PObject * Clone() const; 00095 00112 virtual PBoolean Write( 00113 const void * buf, 00114 PINDEX len 00115 ); 00117 00140 virtual PBoolean Listen( 00141 unsigned queueSize = 5, 00142 WORD port = 0, 00143 Reusability reuse = AddressIsExclusive 00144 ); 00145 virtual PBoolean Listen( 00146 const Address & bind, 00147 unsigned queueSize = 5, 00148 WORD port = 0, 00149 Reusability reuse = AddressIsExclusive 00150 ); 00151 00166 virtual PBoolean Accept( 00167 PSocket & socket 00168 ); 00170 00184 virtual PBoolean WriteOutOfBand( 00185 const void * buf, 00186 PINDEX len 00187 ); 00188 00195 virtual void OnOutOfBand( 00196 const void * buf, 00197 PINDEX len 00198 ); 00200 00201 00202 protected: 00203 // Open an IPv4 socket (for backward compatibility) 00204 virtual PBoolean OpenSocket(); 00205 00206 // Open an IPv4 or IPv6 socket 00207 virtual PBoolean OpenSocket( 00208 int ipAdressFamily 00209 ); 00210 00211 virtual const char * GetProtocolName() const; 00212 00213 00214 // Include platform dependent part of class 00215 #ifdef _WIN32 00216 #include "msos/ptlib/tcpsock.h" 00217 #else 00218 #include "unix/ptlib/tcpsock.h" 00219 #endif 00220 }; 00221 00222 #endif // PTLIB_TCPSOCKET_H 00223 00224 00225 // End Of File ///////////////////////////////////////////////////////////////