以下是用QT实现的利用SOCKET编程的例子,两端分别定时向对方放松hello串
.h文件
/****************************************************************************
** Form interface generated from reading ui file 'newprojectdialog.ui'
**
** Created: 鏄熸湡浜?涓夋湀 7 13:54:58 2008
** by: The User Interface Compiler ($Id: qt/main.cpp 3.2.1 edited May 19 14:22 $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef NEWPROJECTDIALOG_H
#define NEWPROJECTDIALOG_H
#include <qvariant.h>
#include <qdialog.h>
#include <qsocketdevice.h>
#include <qsocketnotifier.h>
#include <qstring.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QPushButton;
class QLineEdit;
class QTextEdit;
class NewProjectDialog : public QDialog
{
Q_OBJECT