> I thought about multi-threading for data sending just thinking about > webspiders that are much faster when multi-threading than downloading > all data from a web page in just one thread. > > So if it is true for download...it should be for upload.
WebSpiders write data to disk file after receiving, so multithreading works well since when writing to disk, the thread is blocked and another thread is able to use the CPU to handle data from another request. In your case, when a thread would be blocked by something which doesn't affect another thread ? > Non threaded : > > I send data to one user, then all TCP protocol will be done until last > ack of last packet sent is done, and after this data will be send to > next IP. If the actual machine I am sending data is not responding, or > is very slow to receive because the bandwitdh in LAN part it is > located on is full, then data to next machine will not be sent until > first one completly finished to receive it. Wrong. This doesn't take int account that TWSocket is non blocking and event driven. Your code is never blocked while waiting for data to come in nor waiting for data to be sent. Your code is notifyed (you get an event: OnDataSent or OnDataAvailable) and start running when data comes in (or data is fully sent out). > Threaded : > > I send datas to 10 IP at same time (well, not really at same time as > they are passed to network card in a queued model), and whenever one > or two destinations are really slow, then other thread continue > sending data to others. This is exactly what happend with ICS without resorting to multithreading. Thanks to the asynchronous working model. When you send data with TWSocket, it is put into a dynamically allocated buffer (FIFO). Then it is sent in the background when the layer is able to accept it. The only condition for it to occur is to have a message pump properly working. Easy. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
