Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef QUDPSOCKET_H
00043 #define QUDPSOCKET_H
00044
00045 #include <QtNetwork/qabstractsocket.h>
00046 #include <QtNetwork/qhostaddress.h>
00047
00048 QT_BEGIN_HEADER
00049
00050 QT_BEGIN_NAMESPACE
00051
00052 QT_MODULE(Network)
00053
00054 #ifndef QT_NO_UDPSOCKET
00055
00056 class QUdpSocketPrivate;
00057
00058 class Q_NETWORK_EXPORT QUdpSocket : public QAbstractSocket
00059 {
00060 Q_OBJECT
00061 public:
00062 enum BindFlag {
00063 DefaultForPlatform = 0x0,
00064 ShareAddress = 0x1,
00065 DontShareAddress = 0x2,
00066 ReuseAddressHint = 0x4
00067 };
00068 Q_DECLARE_FLAGS(BindMode, BindFlag)
00069
00070 explicit QUdpSocket(QObject *parent = 0);
00071 virtual ~QUdpSocket();
00072
00073 bool bind(const QHostAddress &address, quint16 port);
00074 bool bind(quint16 port = 0);
00075 bool bind(const QHostAddress &address, quint16 port, BindMode mode);
00076 bool bind(quint16 port, BindMode mode);
00077
00078
00079 bool hasPendingDatagrams() const;
00080 qint64 pendingDatagramSize() const;
00081 qint64 readDatagram(char *data, qint64 maxlen, QHostAddress *host = 0, quint16 *port = 0);
00082 qint64 writeDatagram(const char *data, qint64 len, const QHostAddress &host, quint16 port);
00083 inline qint64 writeDatagram(const QByteArray &datagram, const QHostAddress &host, quint16 port)
00084 { return writeDatagram(datagram.constData(), datagram.size(), host, port); }
00085
00086 private:
00087 Q_DISABLE_COPY(QUdpSocket)
00088 Q_DECLARE_PRIVATE(QUdpSocket)
00089 };
00090
00091 Q_DECLARE_OPERATORS_FOR_FLAGS(QUdpSocket::BindMode)
00092
00093 #endif // QT_NO_UDPSOCKET
00094
00095 QT_END_NAMESPACE
00096
00097 QT_END_HEADER
00098
00099 #endif // QUDPSOCKET_H