Ekomunthe48 / lidgren-network-gen3

Automatically exported from code.google.com/p/lidgren-network-gen3
0 stars 0 forks source link

large message is never received #156

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
First of all sorry for my bad english.

I am using lidgren for my application and on my local network everything works 
fine and fast. But when I am using the server-application on a server and 
connect to it through the internet, I have some problems with large messages 
(1.8 MB). With normal small messages there are no problems an they get 
received, but sending a large message the server never receive it. Normally the 
server should receive the data, save it, and send a message back.

I watched the network activity with the task manager on both sides, server and 
client, and the client is sending data all the time, but on the server there is 
nothing. Sometimes the connection got lost - at my last try after 3 minutes - 
but if not, after 30 minutes the client is sending data, but the server receive 
nothing.

I know this could also be a problem with the internet connection, but uploading 
2 MB of data tooks not more than a minute. I have tryed it on defferent places 
with different internet connections, but there is always the same result.

Original issue reported on code.google.com by webmas...@oesterreich-mod.at on 18 Oct 2013 at 5:16

GoogleCodeExporter commented 8 years ago
Could you try the "ImageSample" and send a very large file using it? I can send 
very large files using this sample.

Original comment by lidg...@gmail.com on 13 Jan 2014 at 8:08

GoogleCodeExporter commented 8 years ago
It is almost the same code as in the example, but the transmission does not 
work. As I said: On the local machine, there are no problems.

Original comment by webmas...@oesterreich-mod.at on 28 Jan 2014 at 8:27

GoogleCodeExporter commented 8 years ago
Hey,
I've also been having the same issue in my game. When a player connects or 
enters a new sector(a bit like map), they receive a bunch of data about it. 
This is typically up to about 800kb in a reliable message. I don't have a great 
internet connection(2mb), but it's certainly decent enough to receive 800kb.

As soon as a player with a slowish internet connection enters one of these 
areas, Lidgren starts sending that 800kb packet over and over to it. To the 
point where if I or other who have tested for me open the resource monitor 
their download is peaking from the application because the server is blitzing 
them with the packet data but the client is never correctly saying "Hey I 
received this!". I've had to switch to my own library temporarily but it's 
really nothing in comparison to Lidgren.

I have a completely reproducible case of this. With no changes to the 
ImageSample, if I host the server project on my dedicated server and then 
connect to it via the client to download a 800kb image file it will simply just 
send me data forever at my peak download rate but never arrive. This seems to 
be connection based, since my friend has no issue playing my game and has fibre 
optic internet. The issue effects me and a bunch of my players who I've mostly 
verified are on slower connections, but not so slow that it should be a 
problem. I'm releasing my game on Steam very soon so any more data I can 
provide to help fix this sooner I am happy too!

Thanks,
Ben

Original comment by MrBenjam...@gmail.com on 1 Jul 2014 at 7:17

GoogleCodeExporter commented 8 years ago
It's also worth noting that it doesn't happen with the artificial lag 
simulation. Which I forgot to mention. 

Original comment by MrBenjam...@gmail.com on 1 Jul 2014 at 7:35

aienabled commented 4 years ago

What's really interesting about this issue is that the client not only struggling to download the data but the server is oversaturating the bandwidth easily by trying to resend all the data which is not sent. For example, we're hosting several game servers in mainland China with bandwidth at about 5 Mbps per server. Each client is consuming very little (like 0.05 Mbps) but new connecting clients need to download 200-500 KB of data (+replicate all the new delta changes since the login) before they can proceed in the game. I've found that if the client has limited bandwidth (even artificially limited with a tool like NetLimiter) to 0.02 Mbps they never receive the data as the server starting resending more and more data eventually saturating the bandwidth limit (5 Mbps).

So the problem is that slow connection causing extreme overload because all the (large, taking seconds to download on such slow connection) data is resent to it by timer when the packets are considered to be delayed (default reliability mechanism). I was able to work around the issue by changing to ensure that only the last fragment is resent by the delay check loop instead of all the fragments. It's not a simple fix (over 60 LOC across 4 files) and not reliable (if a slow client experiencing significant packet loss it's likely to get disconnected by timeout due to not receiving some of the earlier reliable packets) but at least it works fine to the most players.

Regards!