All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
tcpsock.h
Go to the documentation of this file.
/*
* tcpsock.h
*
* Transmission Control Protocol socket channel class.
*
* Portable Windows Library
*
* Copyright (c) 1993-1998 Equivalence Pty. Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Portable Windows Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Portions are Copyright (C) 1993 Free Software Foundation, Inc.
* All Rights Reserved.
*
* Contributor(s): ______________________________________.
*
* $Revision: 24177 $
* $Author: rjongbloed $
* $Date: 2010-04-05 06:52:04 -0500 (Mon, 05 Apr 2010) $
*/
#ifndef PTLIB_TCPSOCKET_H
#define PTLIB_TCPSOCKET_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
class PTCPSocket : public PIPSocket
{
PCLASSINFO(PTCPSocket, PIPSocket);
public:
PTCPSocket(
WORD port = 0
);
PTCPSocket(
const PString & service
);
PTCPSocket(
const PString & address,
WORD port
);
PTCPSocket(
const PString & address,
const PString & service
);
PTCPSocket(
PSocket & socket
);
PTCPSocket(
PTCPSocket & tcpSocket
);
virtual PObject * Clone() const;
virtual PBoolean Write(
const void * buf,
PINDEX len
);
virtual PBoolean Listen(
unsigned queueSize = 5,
WORD port = 0,
Reusability reuse = AddressIsExclusive
);
virtual PBoolean Listen(
const Address & bind,
unsigned queueSize = 5,
WORD port = 0,
Reusability reuse = AddressIsExclusive
);
virtual PBoolean Accept(
PSocket & socket
);
virtual PBoolean WriteOutOfBand(
const void * buf,
PINDEX len
);
virtual void OnOutOfBand(
const void * buf,
PINDEX len
);
protected:
// Open an IPv4 socket (for backward compatibility)
virtual PBoolean OpenSocket();
// Open an IPv4 or IPv6 socket
virtual PBoolean OpenSocket(
int ipAdressFamily
);
virtual const char * GetProtocolName() const;
// Include platform dependent part of class
#ifdef _WIN32
#include "msos/ptlib/tcpsock.h"
#else
#include "unix/ptlib/tcpsock.h"
#endif
};
#endif // PTLIB_TCPSOCKET_H
// End Of File ///////////////////////////////////////////////////////////////
PSocket::AddressIsExclusive
Definition: socket.h:86
PTCPSocket::Clone
virtual PObject * Clone() const
Create a copy of the class on the heap.
PTCPSocket::Write
virtual PBoolean Write(const void *buf, PINDEX len)
Low level write to the channel.
PIPSocket
This class describes a type of socket that will communicate using the Internet Protocol.
Definition: ipsock.h:63
PSocket::port
WORD port
Port to be used by the socket when opening the channel.
Definition: socket.h:444
PBoolean
BOOL PBoolean
Definition: object.h:102
PTCPSocket::Listen
virtual PBoolean Listen(unsigned queueSize=5, WORD port=0, Reusability reuse=AddressIsExclusive)
Listen on a socket for a remote host on the specified port number.
PTCPSocket::Accept
virtual PBoolean Accept(PSocket &socket)
Open a socket to a remote host on the specified port number.
PTCPSocket::PTCPSocket
PTCPSocket(WORD port=0)
Create a TCP/IP protocol socket channel.
PString
The character string class.
Definition: pstring.h:108
PTCPSocket
A socket that uses the TCP transport on the Internet Protocol.
Definition: tcpsock.h:44
PTCPSocket::OpenSocket
virtual PBoolean OpenSocket()
PIPSocket::Address
A class describing an IP address.
Definition: ipsock.h:75
PTCPSocket::GetProtocolName
virtual const char * GetProtocolName() const
This function returns the protocol name for the socket type.
PSocket
A network communications channel.
Definition: socket.h:58
PTCPSocket::WriteOutOfBand
virtual PBoolean WriteOutOfBand(const void *buf, PINDEX len)
Write out of band data from the TCP/IP stream.
PSocket::Reusability
Reusability
Flags to reuse of port numbers in Listen() function.
Definition: socket.h:84
PObject
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
PTCPSocket::OnOutOfBand
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...