#ifndef UDP_UDPclient_H
#define UDP_UDPclient_H
#include <QtNetwork/QUdpSocket>
#include <QHostAddress>
#include <QThread>
#pragma once
class UDPclient: public QObject
{
public:
private slots:
};
#endif
UDPclient.cpp
#include "UDPclient.h"
QUdpSocket
void UDPclient::InitSocket()
{
}
void UDPclient::Recv()
{
}
函数解释:pendingDatagramSize
server端,顺便学习写下个多进程QThread:
main.cpp
#include <QtGui/QApplication>
#include "UDP_QT.h"
int main(int argc, char *argv[])
{
}
#ifndef UDP_QT_H
#define UDP_QT_H
#include <QtNetwork/QUdpSocket>
#include <QHostAddress>
#include <QThread>
#pragma once
class UDP_QT: public QThread
{
private:
public:
};
#endif
UDP_QT.cpp
#include "UDP_QT.h"
QUdpSocket
char ToAddress[20]="10.144.123.237";
void UDP_QT::InitSocket()
{
}
void UDP_QT::Send()
{
}
void UDP_QT::run() //运行进程
{
}