PTLib  Version 2.18.8
 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 
30 #ifndef PTLIB_TCPSOCKET_H
31 #define PTLIB_TCPSOCKET_H
32 
33 #ifdef P_USE_PRAGMA
34 #pragma interface
35 #endif
36 
37 
40 class PTCPSocket : public PIPSocket
41 {
42  PCLASSINFO(PTCPSocket, PIPSocket);
43  public:
53  PTCPSocket(
54  WORD port = 0
55  );
56  PTCPSocket(
57  const PString & service
58  );
59  PTCPSocket(
60  const PString & address,
61  WORD port
62  );
63  PTCPSocket(
64  const PString & address,
65  const PString & service
66  );
67  PTCPSocket(
68  PSocket & socket
69  );
70  PTCPSocket(
71  PTCPSocket & tcpSocket
72  );
74 
89  virtual PObject * Clone() const;
91 
108  virtual PBoolean Write(
109  const void * buf,
110  PINDEX len
111  );
113 
130  virtual PBoolean Accept(
131  PSocket & socket
132  );
134 
148  virtual PBoolean WriteOutOfBand(
149  const void * buf,
150  PINDEX len
151  );
152 
159  virtual void OnOutOfBand(
160  const void * buf,
161  PINDEX len
162  );
164 
165 
166  protected:
167  // Open an IPv4 socket (for backward compatibility)
168  virtual PBoolean OpenSocket();
169 
170  // Open an IPv4 or IPv6 socket
171  virtual PBoolean OpenSocket(
172  int ipAdressFamily
173  );
174 
175  virtual bool InternalListen(const Address & bind, unsigned queueSize, WORD port, Reusability reuse);
176 
177  virtual const char * GetProtocolName() const;
178 
179 
180 // Include platform dependent part of class
181 #ifdef _WIN32
182 #include "msos/ptlib/tcpsock.h"
183 #else
184 #include "unix/ptlib/tcpsock.h"
185 #endif
186 };
187 
188 #endif // PTLIB_TCPSOCKET_H
189 
190 
191 // End Of File ///////////////////////////////////////////////////////////////
virtual PObject * Clone() const
Create a copy of the class on the heap.
virtual bool InternalListen(const Address &bind, unsigned queueSize, WORD port, Reusability reuse)
virtual PBoolean Write(const void *buf, PINDEX len)
Low level write to the channel.
This class describes a type of socket that will communicate using the Internet Protocol.
Definition: ipsock.h:47
virtual PBoolean Accept(PSocket &socket)
Open a socket to a remote host on the specified port number.
bool PBoolean
Definition: object.h:174
PTCPSocket(WORD port=0)
Create a TCP/IP protocol socket channel.
The character string class.
Definition: pstring.h:108
A socket that uses the TCP transport on the Internet Protocol.
Definition: tcpsock.h:40
virtual PBoolean OpenSocket()
A class describing an IP address.
Definition: ipsock.h:59
virtual const char * GetProtocolName() const
This function returns the protocol name for the socket type.
A network communications channel.
Definition: socket.h:59
virtual PBoolean WriteOutOfBand(const void *buf, PINDEX len)
Write out of band data from the TCP/IP stream.
Reusability
Flags to reuse of port numbers in Listen() function.
Definition: socket.h:85
Ultimate parent class for all objects in the class library.
Definition: object.h:2204
virtual void OnOutOfBand(const void *buf, PINDEX len)
This is callback function called by the system whenever out of band data from the TCP/IP stream is re...