SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWSecureSocketListener Class Reference

Creates a secure socket listener, which waits on a user-defined socket address for incoming connections. More...

#include <rw/secsock/RWSecureSocketListener.h>

Inheritance diagram for RWSecureSocketListener:
RWSocketPortalBase

Public Member Functions

 RWSecureSocketListener ()
 
 RWSecureSocketListener (const RWSecureSocket &socket, WhoShouldClose who=Portal)
 
 RWSecureSocketListener (const RWSockAddrBase &addr, const RWSecureSocketContext &context, int backlog=5)
 
 ~RWSecureSocketListener ()
 
RWSecureSocketPortal accept (RWSockAddr *addr=0) const
 
RWSecureSocket getSocket () const
 
void listen (const RWSockAddrBase &addr, const RWSecureSocketContext &context, int backlog=5)
 
RWSecureSocketPortal operator() (RWSockAddr *addr=0) const
 

Additional Inherited Members

- Public Types inherited from RWSocketPortalBase
enum  WhoShouldClose { Portal , Application }
 

Detailed Description

RWSecureSocketListener creates a secure socket listener, which waits on a user-defined socket address for incoming connections. Connections are obtained as RWSecureSocketPortal instances.

Constructor & Destructor Documentation

◆ RWSecureSocketListener() [1/3]

RWSecureSocketListener::RWSecureSocketListener ( )

Creates an uninitialized secure socket listener. Self cannot be used until is initialized using listen().

◆ RWSecureSocketListener() [2/3]

RWSecureSocketListener::RWSecureSocketListener ( const RWSockAddrBase & addr,
const RWSecureSocketContext & context,
int backlog = 5 )

Sets up a listener on addr using context, and sets up a queue to wait for connections. The backlog parameter specifies the number of incoming connection requests that the protocol software enqueues while a connection is being processed.

Note
This constructor initializes a socket and sets the SO_REUSEADDR option on the socket. If you do not want this option to be set, pass an initalized socket to RWSecureSocketListener(const RWSecureSocket&,WhoShouldClose). See section "Socket Security" under Chapter 8, "The Windows Socket Adapter" in the Essential Networking Module User's Guide for more information.

◆ RWSecureSocketListener() [3/3]

RWSecureSocketListener::RWSecureSocketListener ( const RWSecureSocket & socket,
WhoShouldClose who = Portal )

Creates a listening portal to the communications channel, where socket is the socket doing the listening. This constructor is the only way to create a socket listener whose underlying socket is not closed when portals are not using it.

◆ ~RWSecureSocketListener()

RWSecureSocketListener::~RWSecureSocketListener ( )

Closes the socket if self is the last referencing portal and WhoShouldClose is not Application.

Member Function Documentation

◆ accept()

RWSecureSocketPortal RWSecureSocketListener::accept ( RWSockAddr * addr = 0) const

Receives the next waiting connection. The address of the connecting client will be stored in the RWSockAddr referenced by addr.

◆ getSocket()

RWSecureSocket RWSecureSocketListener::getSocket ( ) const

Returns a copy of the RWSecureSocket underlying this RWSecureSocketListener.

◆ listen()

void RWSecureSocketListener::listen ( const RWSockAddrBase & addr,
const RWSecureSocketContext & context,
int backlog = 5 )

Binds the listener to addr using context, and sets up a queue to wait for connections. The backlog parameter specifies the number of incoming connection requests that the protocol software enqueues while a connection is being processed.

Note
This function initializes a socket and sets the SO_REUSEADDR option on the socket. If you do not want this option to be set, pass an initalized socket to RWSecureSocketListener(const RWSecureSocket&,WhoShouldClose). See section "Socket Security" under Chapter 8, "The Windows Socket Adapter" in the Essential Networking Module User's Guide for more information.

◆ operator()()

RWSecureSocketPortal RWSecureSocketListener::operator() ( RWSockAddr * addr = 0) const

Receives the next waiting connection. The address of the connecting client will be stored in the RWSockAddr referenced by addr.

Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.