7

Background

I am attempting to stream a live feed of a remote computers' desktop to my application. To do this I am using connection-orientated (TCP) sockets, capturing a frame of the client's computer and sending it to the server.

My Research

I am sending a frame (screenshot) every 100 milliseconds (that's 10 FPS). Each frame is around 145kb, that means I need to send 1450kb a second (which equates to 1.4 megabytes, 11 mega bits a second).

My internet has a maximum download speed of 0.32 mega bits per second. Because I need to send 11 mega bits of data a second, this means I my internet is 10.6 megabits slower than what I need. So by my calculations, in order to stream the desktop efficiently I need each frame to be approximately 4.5kb (4608b + 20b TCP header) which is realistically, impossible given the current system, even when sending only updated parts of the desktop and compressing bitmaps.

Question

I am not sure that the system is limited exactly by the upload speed. I think this because 4.5kb is a ridiculously small size. I can stream my desktop perfectly smoothly using similar software (software such as Teamviewer, Join.me and Skype) and even though these software packages use far more intelligent protocols than me (good question here) I highly doubt that they are sending just 4.5kb each frame / desktop update.

So my question is ultimately; are my calculations at all accurate and why? My aim here is to decide what is an appropriate size for each frame so I can then work to reach that size and calculate the quality / interval for different speed connections. I am interested in any comments / answers that are helpful to my situation of course, but the answer I accept will be the one that answers my actual question.

Community
  • 1
  • 1
Caster Troy
  • 2,796
  • 2
  • 25
  • 45
  • What kind of local network do you have that is only 0.32 mbps? (also, @SteveTownsend answer is quite on track) – Jcl Mar 07 '13 at 14:27
  • 1. Are you opening and closing a socket connection for each frame or keeping the connection open? 2. Have you experimented with sending frames via UDP instead of TCP, just to see what sort of difference that makes? – dgvid Mar 07 '13 at 14:28
  • @dgvid 1. keeping the connection open 2. no I have not, I will in the future. – Caster Troy Mar 07 '13 at 14:35

2 Answers2

1

don't confuse bits and bytes first of all, because your calculations are a bit confusing.

second of all, you are only looking at the size of the object you are sending, you are forgetting the packet itself, it adds a bit to the size and don't forget the TCP delay you will endure. If your network is this sensitive to sending traffic, I would suggest upgrading it, or use better compressions.

To conclude I would always say: the bandwidth supported by the network is equal to the part with the smallest bandwidth along the needed path.

ex: 10M => 100K => 1M ==> 10M (here the max speed is 100K)

Bulki
  • 734
  • 1
  • 10
  • 30
0

Is the Maximum Send Speed of a TCP Client Limited Exactly by the Client Computers' Upload Speed

It's a meaningless question. For any given connection, they are the same thing, and they are both determined by the speed of the slowest link between them.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • 1
    A network connection is only as fast as the slowest link. TCP does its best to find faster routes, but that is based on routers and switches talking to each other and a whole bunch of stuff outside of your control. To further expand this, a host has a fixed size pipe from it, to the first switch. This pipe is shared by all transmissions on the host. TCP will always balance itself out sharing the pipe equally. If 2 programs are trying to send out over a 100mbit link (assuming no network congestion anywhere along the line to the destination) they will each get roughly 50mbit of bandwidth. – Pete Garafano Mar 08 '13 at 00:24
  • @TheGreatCO Okay, that's good information. I completely forgot about the TCP header size and congestion control! I think the header is 20 bytes? But what this means is my maximum send speed is even less than what I calculated assuming my theory (title) is correct. – Caster Troy Mar 08 '13 at 01:06
  • There's a proof somewhere that the maximum attainable usage of a TCP connection is 83% of the theoretical bandwith, but it's many years since I saw it. – user207421 Mar 08 '13 at 01:14
  • @EJP that is interesting, I've never heard that before. But even if that is the case, TCP will equally split the available bandwidth among all applications attempting to transmit. – Pete Garafano Mar 08 '13 at 01:36
  • @TheGreatCO Of course it will: my answer doesn't say otherwise, does it? The 83% was in was a paper published in the late 1980s or early 1990s. – user207421 Mar 08 '13 at 02:28
  • @EJP I've been looking for that paper but I haven't been able to find it. If you ever come across it again, try and remember to shoot it my way. I would appreciate it a lot. – Pete Garafano Mar 08 '13 at 03:27