this is my code
#include "tcpclient.h"
#include<QThread>
#include <QHostAddress>
#include<iostream>
using namespace std;
tcpclient::tcpclient(QObject* parent): QObject(parent)
{
connect(&client, SIGNAL(connected()),this, SLOT(startTransfer()));
}
tcpclient::~tcpclient()
{
client.close();
}
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];
connect(&client, SIGNAL(readyRead()),this, SLOT(receivedata()));
}
void tcpclient::receivedata()
{
char buffer[1024] = {0};
client.read(buffer, client.bytesAvailable());
cout << buffer << endl;
cout.flush();
client.write("inifinity sending", 18);
connect(&client, SIGNAL(readyRead()),this, SLOT(receivedata()));
}
void tcpclient::closing()
{
cout<<"closing";
client.close();
}
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]