int port = 50000;
connect(&socket,SIGNAL(connected()),this,SLOT(isConnected()));
socket.waitForConnected(1000);
//socket.write((const char *)"sdfsdf",5);
out << "sample text" << endl;
socket.disconnectFromHost();
int port = 50000;
QTcpSocket socket(this);
connect(&socket,SIGNAL(connected()),this,SLOT(isConnected()));
socket.connectToHost(QHostAddress::LocalHost,port,QIODevice::ReadWrite);
socket.waitForConnected(1000);
//socket.write((const char *)"sdfsdf",5);
QTextStream out(&socket);
out << "sample text" << endl;
socket.disconnectFromHost();
To copy to clipboard, switch view to plain text mode
Bookmarks