PTLib  Version 2.14.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
tcpsock.h
Go to the documentation of this file.
1 /*
2  * tcpsock.h
3  *
4  * Transmission Control Protocol socket channel class.
5  *
6  * Portable Windows Library
7  *
8  * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
9  *
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.0 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS"
16  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  * the License for the specific language governing rights and limitations
18  * under the License.
19  *
20  * The Original Code is Portable Windows Library.
21  *
22  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23  *
24  * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25  * All Rights Reserved.
26  *
27  * Contributor(s): ______________________________________.
28  *
29  * $Revision: 25706 $
30  * $Author: rjongbloed $
31  * $Date: 2011-05-08 21:47:57 +1000 (Sun, 08 May 2011) $
32  */
33 
34 #ifndef PTLIB_TCPSOCKET_H
35 #define PTLIB_TCPSOCKET_H
36 
37 #ifdef P_USE_PRAGMA
38 #pragma interface
39 #endif
40 
41 
44 class PTCPSocket : public PIPSocket
45 {
46  PCLASSINFO(PTCPSocket, PIPSocket);
47  public:
57  PTCPSocket(
58  WORD port = 0
59  );
60  PTCPSocket(
61  const PString & service
62  );
63  PTCPSocket(
64  const PString & address,
65  WORD port
66  );
67  PTCPSocket(
68  const PString & address,
69  const PString & service
70  );
71  PTCPSocket(
72  PSocket & socket
73  );
74  PTCPSocket(
75  PTCPSocket & tcpSocket
76  );
78 
93  virtual PObject * Clone() const;
95 
112  virtual PBoolean Write(
113  const void * buf,
114  PINDEX len
115  );
117 
134  virtual PBoolean Accept(
135  PSocket & socket
136  );
138 
152  virtual PBoolean WriteOutOfBand(
153  const void * buf,
154  PINDEX len
155  );
156 
163  virtual void OnOutOfBand(
164  const void * buf,
165  PINDEX len
166  );
168 
169 
170  protected:
171  // Open an IPv4 socket (for backward compatibility)
172  virtual PBoolean OpenSocket();
173 
174  // Open an IPv4 or IPv6 socket
175  virtual PBoolean OpenSocket(
176  int ipAdressFamily
177  );
178 
179  virtual bool InternalListen(const Address & bind, unsigned queueSize, WORD port, Reusability reuse);
180 
181  virtual const char * GetProtocolName() const;
182 
183 
184 // Include platform dependent part of class
185 #ifdef _WIN32
186 #include "msos/ptlib/tcpsock.h"
187 #else
188 #include "unix/ptlib/tcpsock.h"
189 #endif
190 };
191 
192 #endif // PTLIB_TCPSOCKET_H
193 
194 
195 // End Of File ///////////////////////////////////////////////////////////////