00001 #ifndef RECEIVER_H 00002 #define RECEIVER_H 00003 00004 #include <QWidget> 00005 #include <QtNetwork> 00006 #include <QUdpSocket> 00007 #include <QUrl> 00008 00009 00010 00011 /// UDP Receiver (server) 00012 class Receiver : public QWidget 00013 { 00014 Q_OBJECT 00015 00016 private: 00017 QUdpSocket *udpSocket; 00018 00019 public: 00020 Receiver(QWidget *parent = 0); 00021 bool isListening(); 00022 00023 signals: 00024 void textReceived(QString line); 00025 void connectionBound(); 00026 void connectionClose(); 00027 00028 public slots: 00029 void bindUrl(QUrl url); 00030 void sendText(QString text); 00031 void disconnect(); 00032 00033 private slots: 00034 void processPendingDatagrams(); 00035 void udp_connected(); 00036 void udp_disconnected(); 00037 void udp_stateChanged( QAbstractSocket::SocketState state ); 00038 }; 00039 00040 #endif