Main Page | Class Hierarchy | Class List | File List | Class Members

SST::StreamServer Class Reference

This class represents a server that can accept incoming SST connections. More...

#include <stream.h>

List of all members.

Signals

void newConnection ()
 Emitted when a new connection arrives.


Public Member Functions

 StreamServer (Host *host, QObject *parent=NULL)
 Create a StreamServer instance.

bool listen (const QString &serviceName, const QString &serviceDesc, const QString &protocolName, const QString &protocolDesc)
 Listen for incoming connections to a particular service using a particular application protocol.

bool isListening ()
 Returns true if this StreamServer is currently listening.

Streamaccept ()
 Accept an incoming connection as a top-level Stream.

Streamaccept (QByteArray &originHostId)
 Accept an incoming connection, and obtain the EID of the originating host.

QString serviceName ()
 Returns the service name previously supplied to listen().

QString serviceDescription ()
 Returns the service description previously supplied to listen().

QString protocolName ()
 Returns the protocol name previously supplied to listen().

QString protocolDescription ()
 Returns the protocol description previously supplied to listen().

QString errorString ()
 Returns a string describing the last error that occurred, if any.


Protected Member Functions

void setErrorString (const QString &err)
 Set the current error description string.


Friends

class BaseStream


Detailed Description

This class represents a server that can accept incoming SST connections.

To use this class, the application creates a StreamServer instance, calls listen() to begin listening for connections, and upon arrival of a newConnection() signal uses accept() to accept any queued incoming connections.


Constructor & Destructor Documentation

StreamServer::StreamServer Host host,
QObject *  parent = NULL
 

Create a StreamServer instance.

The application must call listen() before the StreamServer will actually accept incoming connections.

Parameters:
host the Host object containing hostwide SST state.
parent the Qt parent for the new object. The Stream will be automatically destroyed when its parent is destroyed.


Member Function Documentation

Stream* SST::StreamServer::accept QByteArray &  originHostId  )  [inline]
 

Accept an incoming connection, and obtain the EID of the originating host.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Stream * StreamServer::accept  ) 
 

Accept an incoming connection as a top-level Stream.

Upon receiving a newConnection() signal, the application must call accept() in a loop until there are no more incoming connections to accept.

Stream objects returned from this method initially have the StreamServer as their Qt parent, so they are automatically deleted if the StreamServer is deleted. The application may re-parent these Stream objects if desired, in which case the Stream may outlive the StreamServer object.

Returns:
a new Stream representing ths incoming connection, or NULL if no connections are currently waiting.

bool StreamServer::listen const QString &  serviceName,
const QString &  serviceDesc,
const QString &  protocolName,
const QString &  protocolDesc
 

Listen for incoming connections to a particular service using a particular application protocol.

This method may only be called once on a StreamServer instance. An error occurs if another StreamServer object is already listening on the specified service/protocol name pair on this host.

Parameters:
serviceName the service name on which to listen. Clients must specify the same service name via connectTo() to connect to this server.
serviceDescr a short human-readable service description for use for example by utilities that browse or control the set of services running on a particular host.
protocolName the protocol name on which to listen. Clients must specify the same protocol name via connectTo() to connect to this server.
protocolDesc a short human-readable description of the protocol, useful for browsing the set of protocols a particular service supports.
Returns:
true if successful, false if an error occurred.


The documentation for this class was generated from the following files:
Generated on Wed Mar 28 11:48:05 2007 for SST by doxygen 1.3.4