KDECore
ksocketfactory.h
Go to the documentation of this file.
00001 /* 00002 * This file is part of the KDE libraries 00003 * Copyright (C) 2007 Thiago Macieira <thiago@kde.org> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef KSOCKETFACTORY_H 00022 #define KSOCKETFACTORY_H 00023 00024 #include <kdecore_export.h> 00025 #include <QtCore/QString> 00026 #include <QtNetwork/QNetworkProxy> 00027 #include <QtNetwork/QHostAddress> 00028 00029 class QTcpSocket; 00030 class QTcpServer; 00031 class QUdpSocket; 00032 class QUrl; 00033 00068 namespace KSocketFactory 00069 { 00099 KDECORE_EXPORT QTcpSocket *connectToHost(const QString &protocol, const QString &host, 00100 quint16 port, QObject *parent = 0); 00101 00105 KDECORE_EXPORT QTcpSocket *connectToHost(const QUrl &url, QObject *parent = 0); 00106 00110 KDECORE_EXPORT void connectToHost(QTcpSocket *socket, const QString &protocol, 00111 const QString &host, quint16 port); 00112 00116 KDECORE_EXPORT void connectToHost(QTcpSocket *socket, const QUrl &url); 00117 00145 KDECORE_EXPORT QTcpSocket *synchronousConnectToHost(const QString &protocol, 00146 const QString &host, 00147 quint16 port, int msecs = 30000, 00148 QObject *parent = 0); 00149 00153 KDECORE_EXPORT QTcpSocket *synchronousConnectToHost(const QUrl &url, int msecs = 30000, 00154 QObject *parent = 0); 00155 00159 KDECORE_EXPORT void synchronousConnectToHost(QTcpSocket *socket, const QString &protocol, 00160 const QString &host, quint16 port, 00161 int msecs = 30000); 00162 00166 KDECORE_EXPORT void synchronousConnectToHost(QTcpSocket *socket, const QUrl &url, 00167 int msecs = 30000); 00168 00189 KDECORE_EXPORT QTcpServer *listen(const QString &protocol, const QHostAddress &address = QHostAddress::Any, 00190 quint16 port = 0, QObject *parent = 0); 00191 00192 // These functions below aren't done yet 00193 // Undocumented -> don't use! 00194 00195 KDECORE_EXPORT QUdpSocket *datagramSocket(const QString &protocol, const QString &host, QObject *parent = 0); 00196 00197 #ifndef QT_NO_NETWORKPROXY 00198 KDECORE_EXPORT QNetworkProxy proxyForConnection(const QString &protocol, const QString &host); 00199 KDECORE_EXPORT QNetworkProxy proxyForListening(const QString &protocol); 00200 KDECORE_EXPORT QNetworkProxy proxyForDatagram(const QString &protocol, const QString &host); 00201 #endif 00202 } 00203 00204 #endif
KDE 4.6 API Reference