Hi all)

Well, i'm writing QT based server and Php based client. And has some problem now.
I succesfully connected client to server, Sent data from server and recived it on the client, but i have really big trouble when i tried to read from socket on the server side.
I can get onlu "null" string

Server see that something there are in socket, can get it size(using QtcpSocket function bytesAvailable()), but i can't get that Data.

Qt Code:
  1. void Server::z_read()
  2. {
  3. printf(">> Reciving \n");
  4. QTcpSocket* Clientsocket=(QTcpSocket*)sender();
  5. int incoming=Clientsocket->bytesAvailable();
  6. printf(">> in Socket %d bytes \n",incoming);
  7. char* recieveddata;
  8. printf(">> Reading \n");
  9. QDataStream in(Clientsocket);
  10. in>>recieveddata;
  11. printf(">> Recieved ok \n>> Recieved: %s\n",recieveddata);
  12. }
To copy to clipboard, switch view to plain text mode 

Firstly i tried to modefy standart examples of "Fortune client", but i removed all checks to find problem. In think i've made a mistake somewhere with Qdatastream.

But also i tried use QIOdevice::read() function. There aren't any warnings or errors while compilling. But server crushed with no errors, when it trying to read recieved data.

i think i made somewhere small mistake, but i can't find it for two days.


I use Qt Creator 2.0.0 with it standart compiller.
Qt 4.6
OS Win 7 Starter (Yes i'm programming on netbook))


Ps i started to use QT one week ago)
Pps English is foriegn language for me. I'm sorry for all mistackes i've made.