kstreamsocket.h
/* -*- C++ -*-
* Copyright (C) 2003 Thiago Macieira <thiago@kde.org>
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef KSTREAMSOCKET_H
#define KSTREAMSOCKET_H
#include <qstring.h>
#include "kclientsocketbase.h"
namespace KNetwork {
class KResolverEntry;
class KResolverResults;
class KServerSocket;
class KBufferedSocket;
class KStreamSocketPrivate;
class KDECORE_EXPORT KStreamSocket: public KClientSocketBase
{
Q_OBJECT
public:
KStreamSocket(const QString& node = QString::null, const QString& service = QString::null,
QObject* parent = 0L, const char *name = 0L);
virtual ~KStreamSocket();
int timeout() const;
int remainingTimeout() const;
void setTimeout(int msecs);
virtual bool bind(const QString& node = QString::null,
const QString& service = QString::null);
virtual bool bind(const KResolverEntry& entry)
{ return KClientSocketBase::bind(entry); }
virtual bool connect(const QString& node = QString::null,
const QString& service = QString::null);
virtual bool connect(const KResolverEntry& entry);
signals:
void timedOut();
private slots:
void hostFoundSlot();
void connectionEvent();
void timeoutSlot();
private:
bool bindLocallyFor(const KResolverEntry& peer);
void connectionSucceeded(const KResolverEntry& peer);
KStreamSocket(const KStreamSocket&);
KStreamSocket& operator=(const KStreamSocket&);
KStreamSocketPrivate *d;
friend class KServerSocket;
friend class KBufferedSocket;
};
} // namespace KNetwork
#endif
KNetwork::KStreamSocket
Simple stream socket.
Definition: kstreamsocket.h:97
KNetwork::KServerSocket
A server socket for accepting connections.
Definition: kserversocket.h:107
KNetwork::KResolverEntry
One resolution entry.
Definition: kresolver.h:66
KNetwork::KBufferedSocket
Buffered stream sockets.
Definition: kbufferedsocket.h:58
KNetwork::KStreamSocket::bind
virtual bool bind(const KResolverEntry &entry)
Reimplemented from KClientSocketBase.
Definition: kstreamsocket.h:175
KNetwork::KClientSocketBase
Abstract client socket class.
Definition: kclientsocketbase.h:49
KNetwork::KClientSocketBase::bind
virtual bool bind(const QString &node=QString::null, const QString &service=QString::null)=0
Binds this socket to the given nodename and service, or use the default ones if none are given...
KServerSocket
Monitors a port for incoming TCP/IP connections.
Definition: ksock.h:250

KDE Home | KDE Accessibility Home | Description of Access Keys