Please make sure you understand the code I gave before using it. And never use code you do not understand.
Please make sure you understand the code I gave before using it. And never use code you do not understand.
Please tell me before I will study hard your code, what do you mean by this line
processData(data) (I can't figure out when I should pull out the data I need and for example write the in to the file)
becouse I don't know how to refer to it, and maybe are there any signals I should take a closer look?
Last edited by camol; 10th March 2011 at 13:04.
processData() is a stub for your method for manipulating the data, the core of the server functionality. I don't know what your program is meant to do so I can't tell you what should be there.
basically I am sending files. The server after establishing connection is sending many many files one by one.
So probably processData() should store the data on the disk or somewhere else.
But I have noticed that processData() is in if-condition, and as you can see from my "tests" the program is in that if-condition (you wrote) only once (at the first enter to the slot) and at that time data.size is 0.
Did you adjust the sending side to the semantics of the receiving side or the other way round?
It won't be enough if I just do sth like this?:
Qt Code:
//serverfiles is a QStringList out << (out,serverfiles); serverSocket->write(block);To copy to clipboard, switch view to plain text mode
This code is in slot which starts thx to encrypted signal.
No, not really. You are streaming in a QStringList and reading back 4 bytes assembled into integer and an anonymous block of data. How do you expect it to work?
Becouse I still can't see how it should work this, I don't understand how to adjust the code at the server side(I am sending QSringList which has paths for the client becouse every file which will be received by client should be stored with one path from the received list). I still can't get a rid of this way of thinking about the problem, which was presented in the first post. I wrote it and understand it perfectlly. I still see it like this:
-server sends size of "thing" that will be sended in a second
-client receives size of "thing"(client know that firstly it will get the size)
-server sends the "thing"
-client knows that the "thing" will be now received and thx to the size(that it has just received), client knows how big the "thing" will be.
Maybe you see it like this but you didn't implement it like this.
-server sends size of "thing" that will be sended in a second
-server sends the "thing"Doesn't seem equivalent to me.Qt Code:
//serverfiles is a QStringList out << (out,serverfiles); serverSocket->write(block);To copy to clipboard, switch view to plain text mode
ups it should look like this
Qt Code:
out << (out, serverfiles.size()); serverSocket->write(block); block.clear(); out << (out, serverfiles); serverSocket->write(block); block.clear();To copy to clipboard, switch view to plain text mode
This:
I've also found it in Qt Assistant-as a way of sending QtStringList in right way.Qt Code:
out << (out, serverfiles);To copy to clipboard, switch view to plain text mode
Generally as you can see when client connects to the server it always looks like this;
server sends QStringList
client sends his QStringList
server sends files
That is way my first code wasn't random in its simple construction.
Bookmarks