[font="Arial,"] I have a NetReciever(UDP/TCP) Class intact (just a very simple UDPClient Listening, then use ONE thread to handle data and use a method to process)[/font]
[font="Arial,"], but when I have more than two connection, the server starts lagging as hell. [/font]
[font="Arial,"]I use UDP as Position/Rotation of Guns/Bullets update and TCP for joining etc.[/font]
[font="Arial,"] And i can't seem to have 2+ people in the same server, otherwise the game(server-side) will starts to lag.[/font]
[font="Arial,"] Is there any example for game networking for multiple-connection? [/font]
[font="Arial,"]Like in Terraria, it uses XNA C# too, and btw i don't want to use Live, thanks a lot.[/font]
[font="Arial,"] BTW, i see in Terraria all data is tranferred using TCP, not connectionless, won't that be slow? Thanks=DDD [URGENT][/font]
[font="Arial,"]O and at last, could someone please kindly explain to me how to make a queue of data?[/font]
[font="Arial,"]I seem cannot find any relavant articles....[/font]
[font="Arial,"]Thanks!!!![/font]
[font="Arial,"]
[/font]
[font="Arial,"]{EDIT}[/font]
[font="Arial,"]I found a comment on a website :[/font]
[font=Arial,]I think you are making it too complicated. Just have 1 UDP socket open, and set an async callback on it. For every incoming packet put it in a queue, and set the callback again. Thats it.
make sure that when queuing and dequeueing you set a lock on the queue.
it's as simple as that and performance will be great.
R
[/font]
[/quote]
Can some please provide some examples for me? How can set the callback again?
Put the bytes recieved in a queue and process it in order? but what setting callback again means?
Sorry, i am new to networking...[font=Arial,][/font]