2
* bsocket.h - QSocket wrapper based on Bytestream with SRV DNS support
3
* Copyright (C) 2003 Justin Karneges
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
#include <QAbstractSocket>
26
#include "bytestream.h"
34
class BSocket : public ByteStream
38
enum Error { ErrConnectionRefused = ErrCustom, ErrHostNotFound };
39
enum State { Idle, HostLookup, Connecting, Connected, Closing };
40
BSocket(QObject *parent=0);
43
void connectToHost(const QString &host, quint16 port);
44
void connectToServer(const QString &srv, const QString &type);
52
void write(const QByteArray &);
53
QByteArray read(int bytes=0);
54
int bytesAvailable() const;
55
int bytesToWrite() const;
58
QHostAddress address() const;
62
QHostAddress peerAddress() const;
63
quint16 peerPort() const;
74
void qs_bytesWritten(qint64);
75
void qs_error(QAbstractSocket::SocketError);
84
void reset(bool clear=false);