Actually I never tested it but I just checked and yes you're right there is nothing wrong with using QTcpSocket.
Oh ok. Would you by any chance example coding for QThread being implemented?
Thanks,
Strateng
Originally Posted by tbscope
First let me make clear that you do not have to follow anything I say. I'm just interested in why you want to do some things as I might learn something from it.
First question, you are using a tcp connection to this other program?
Second question, if so, why can't you use QTcpSocket?
Let me destroy one of your dreams (or ideas) right away: on a normal computer, nothing can run at the same time, even when using threads. Every instruction follows another one.
Threads are a way for the operating system to split the workload of long duration loops into manageable parts so each part can run for a certain amount of time. This may look like the code is run at once, while actually it isn't. Total calculation times usually remain the same.
For simple things, like sending or receiving data in chunks (little parts), you do not nead threads as the operating system finds enough time between sending and receiving the data to schedule other things. In fact, what you do when using asynchronous sockets is do what the operating system would do when threading, but without the difficulties of using threads and mutexes and locks etc...
Bookmarks