KNetwork::KPassiveSocketBase

Search for usage in LXR

KNetwork::KPassiveSocketBase Class Referenceabstract

#include <k3socketbase.h>

Inheritance diagram for KNetwork::KPassiveSocketBase:

Public Member Functions

 KPassiveSocketBase ()
 
 ~KPassiveSocketBase () override
 
virtual KActiveSocketBaseaccept ()=0
 
virtual bool bind (const KResolverEntry &address)=0
 
virtual void close ()=0
 
virtual KSocketAddress externalAddress () const =0
 
virtual bool listen (int backlog)=0
 
virtual KSocketAddress localAddress () const =0
 
- Public Member Functions inherited from KNetwork::KSocketBase
 KSocketBase ()
 
virtual ~KSocketBase ()
 
bool addressReuseable () const
 
bool blocking () const
 
bool broadcast () const
 
SocketError error () const
 
QString errorString () const
 
bool isIPv6Only () const
 
QMutexmutex () const
 
bool noDelay () const
 
virtual bool setAddressReuseable (bool enable)
 
virtual bool setBlocking (bool enable)
 
virtual bool setBroadcast (bool enable)
 
virtual bool setIPv6Only (bool enable)
 
virtual bool setNoDelay (bool enable)
 
int setRequestedCapabilities (int add, int remove=0)
 
virtual void setSocketDevice (KSocketDevice *device)
 
KSocketDevicesocketDevice () const
 

Additional Inherited Members

- Public Types inherited from KNetwork::KSocketBase
enum  SocketError {
  NoError = 0, LookupFailure, AddressInUse, AlreadyCreated,
  AlreadyBound, AlreadyConnected, NotConnected, NotBound,
  NotCreated, WouldBlock, ConnectionRefused, ConnectionTimedOut,
  InProgress, NetFailure, NotSupported, Timeout,
  UnknownError, RemotelyDisconnected
}
 
enum  SocketOptions {
  Blocking = 0x01, AddressReuseable = 0x02, IPv6Only = 0x04, Keepalive = 0x08,
  Broadcast = 0x10, NoDelay = 0x20
}
 
- Static Public Member Functions inherited from KNetwork::KSocketBase
static QString errorString (SocketError code)
 
static bool isFatalError (int code)
 
- Protected Member Functions inherited from KNetwork::KSocketBase
bool hasDevice () const
 
void resetError ()
 
void setError (SocketError error)
 
virtual bool setSocketOptions (int opts)
 
virtual int socketOptions () const
 

Detailed Description

Abstract base class for passive sockets.

This socket provides the initial functionality for passive sockets, i.e., sockets that accept incoming connections.

Author
Thiago Macieira thiag[email protected][email protected][email protected]e.org
Deprecated:
Use KSocketFactory or KLocalSocket instead

Definition at line 773 of file k3socketbase.h.

Constructor & Destructor Documentation

◆ KPassiveSocketBase()

KPassiveSocketBase::KPassiveSocketBase ( )

Constructor.

Definition at line 448 of file k3socketbase.cpp.

◆ ~KPassiveSocketBase()

KPassiveSocketBase::~KPassiveSocketBase ( )
override

Destructor.

Definition at line 452 of file k3socketbase.cpp.

Member Function Documentation

◆ accept()

virtual KActiveSocketBase* KNetwork::KPassiveSocketBase::accept ( )
pure virtual

Accepts a new incoming connection.

If this socket was in listening mode, you can call this function to accept an incoming connection.

If this function cannot accept a new connection (either because it is not listening for one or because the operation would block), it will return NULL.

Also note that descended classes will override this function to return specialized socket classes.

Implemented in KNetwork::KServerSocket, and KNetwork::KSocketDevice.

◆ bind()

virtual bool KNetwork::KPassiveSocketBase::bind ( const KResolverEntry address)
pure virtual

Binds this socket to the given address.

The socket will be constructed with the address family, socket type and protocol as those given in the address object.

Parameters
addressthe address to bind to
Returns
true if the binding was successful, false otherwise

Implemented in KNetwork::KServerSocket, and KNetwork::KSocketDevice.

◆ close()

virtual void KNetwork::KPassiveSocketBase::close ( )
pure virtual

Closes this socket.

All resources used are freed. Note that closing a passive socket does not close the connections accepted with it.

Implemented in KNetwork::KServerSocket, and KNetwork::KSocketDevice.

◆ externalAddress()

virtual KSocketAddress KNetwork::KPassiveSocketBase::externalAddress ( ) const
pure virtual

Returns this socket's externally-visible address if known.

Implemented in KNetwork::KServerSocket, and KNetwork::KSocketDevice.

◆ listen()

virtual bool KNetwork::KPassiveSocketBase::listen ( int  backlog)
pure virtual

Puts this socket into listening mode.

Placing a socket in listening mode means that it will be allowed to receive incoming connections from remote hosts.

Note that some socket types or protocols cannot be put in listening mode.

Parameters
backlogthe number of accepted connections to hold before starting to refuse
Returns
true if the socket is now in listening mode

Implemented in KNetwork::KServerSocket, and KNetwork::KSocketDevice.

◆ localAddress()

virtual KSocketAddress KNetwork::KPassiveSocketBase::localAddress ( ) const
pure virtual

Returns this socket's local address.

Implemented in KNetwork::KServerSocket, and KNetwork::KSocketDevice.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:56:02 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.