LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Single Socket Vs Multiple Socket (https://www.linuxquestions.org/questions/programming-9/single-socket-vs-multiple-socket-369982/)

Kumar 10-05-2005 09:04 AM

Single Socket Vs Multiple Socket
 
Hi,

I have a client and a server and i need to transfer a fixed amount of data from the client to the server.

Please consider these two scenarios -

1. I create a program which opens a single socket connection to the server and starts sending data sequentially. Assume that there is no data is to be received.

2. I create another program with two threads which in turn create 2 sockets to the server. These two threads now start sending the data on two sockets to the server. Assume the data to send is divided between the two threads equally. Also assume that there is no data is to be received and the order in which data is send to the server is not important.

Now my question is, which of the above two process will finish first? Does creating more sockets amount to increased transfer rate? If yes, then how?

Regards,

kjordan 10-05-2005 10:02 AM

I would say they would finish in the same amount of time theoretically unless you have more than one ethernet connection to transfer over or if your network bandwith is huge, then 2 may finish faster. Over a normal internet connection it won't be any faster since instead of downloading say a 1.5 meg file, you're now downloading 2 750k files which usually won't be any faster.


All times are GMT -5. The time now is 09:28 PM.