Guest User

Untitled

a guest
Jul 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. void MainWindow::on_pushButton_clicked()
  2. {
  3. meinServer = new QTcpServer(this);
  4. meinServer->listen(QHostAddress::Any, 12345);
  5.  
  6. connect(meinServer, SIGNAL(newConnection()), this, SLOT(sendText()));
  7.  
  8.  
  9. }
  10.  
  11. void MainWindow::sendText()
  12. {
  13. QTcpSocket * ClientSocket = meinServer->nextPendingConnection();
  14.  
  15. char * buffer = "Hallo Welt";
  16.  
  17. ClientSocket->write(buffer);
  18. ClientSocket->disconnectFromHost();
  19.  
  20. }
Add Comment
Please, Sign In to add comment