Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C++ QT TCP/IP Client
this is my code
#include "tcpclient.h"
#include <QHostAddress>
using namespace std;
tcpclient::tcpclient(QObject* parent): QObject(parent)
  connect(&client, SIGNAL(connected()),this, SLOT(startTransfer()));
void tcpclient::start(QString address, quint16 port)
  QHostAddress addr(address);
  client.connectToHost(addr, port);
void tcpclient::startTransfer()
  client.write("hello world", 12);
   char buffer[1024]/* = "Hello world"*/;
   connect(&client, SIGNAL(readyRead()),this, SLOT(receivedata()));
void tcpclient::receivedata()
    char buffer[1024] = {0};, client.bytesAvailable());
     cout << buffer << endl;
    client.write("inifinity sending", 18);
     connect(&client, SIGNAL(readyRead()),this, SLOT(receivedata()));
void tcpclient::closing()
this client send strings to a server and the server is receiving it
when i try it it send the first string hello world then send inifinity sending one time and receive the answer from the server then when try to send it again there is a Operating System error segmentation fault
my operating system is LINUX
[edit]SHOUTING removed - OriginalGriff[/edit]
Posted 3-Oct-12 1:51am
Edited 3-Oct-12 2:10am
(no name)1.2M
OriginalGriff at 3-Oct-12 7:10am
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalisation if you want to be taken seriously.
amir tarek at 3-Oct-12 7:48am
ok thank you to do this for me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 288
1 ProgramFOX 205
2 Peter Leow 140
3 Sergey Alexandrovich Kryukov 133
4 Dave Kreskowiak 96
0 OriginalGriff 288
1 ProgramFOX 165
2 Peter Leow 130
3 Sergey Alexandrovich Kryukov 95
4 Fredrik Bornander 85

Advertise | Privacy | Mobile
Web01 | 2.8.150301.1 | Last Updated 3 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100