Hello! And sorry I didn't quite know what to name this topic.
This is possibly my last networking question, as everything else is working exactly as expected (and online through Port Forwarding as well).
To the problem:
What's currently happening is that I'm using threads to handle connections on the server (the client is not using threads).
If Client1 walks from X: 0 to X: 100 in 10 seconds, it will take about 20 seconds for everyone on the server to see Client1 get to X: 100
(This is exaggerated. It'd probably take around 13-15 seconds).
It seems like information is stacking up -- thus taking longer to see someone move as their current position consists of.
What I'd like to accomplish is to make it so this doesn't happen. If your X is at 10, everyone should see 10 right as to reach that position. I know this will look buggier than it currently does, but I don't want information to stack like this.
Some possible reasons:
-The client recv and send functions are not in a thread?
-Each server thread WAITS for client info before sending that clients info
Any help/suggestions?
Thanks!! -Luna
Winsock - Send/Recv stacking information?
-
LunaRebirth
- Posts: 385
- Joined: Sun May 11, 2014 12:13 am
Re: Winsock - Send/Recv stacking information?
I don't know specific function calls behind it but I know the terms used to describe your issue.
It sounds like your receive function is 'blocking' you need to figure out how to make it 'non blocking' this means that when the receive function is called it will not wait any specific amount of time for packets to arrive, if there is a packet to process then it will process, if there is no packet to process the code will just continue about it's business. Also, positional and rotational updates are better sent as UDP packets. There should be no reason to send them as TCP.
It sounds like your receive function is 'blocking' you need to figure out how to make it 'non blocking' this means that when the receive function is called it will not wait any specific amount of time for packets to arrive, if there is a packet to process then it will process, if there is no packet to process the code will just continue about it's business. Also, positional and rotational updates are better sent as UDP packets. There should be no reason to send them as TCP.
Dream Big Or Go Home.
Help Me Help You.
Help Me Help You.
-
LunaRebirth
- Posts: 385
- Joined: Sun May 11, 2014 12:13 am
Re: Winsock - Send/Recv stacking information?
No change in the problem if both, the server and client, are set to non-blocking.
On the part about UDP, Would you happen to know how to use Winsock for UDP and TCP at the same time? I've looked it up before, but never understood.
On the part about UDP, Would you happen to know how to use Winsock for UDP and TCP at the same time? I've looked it up before, but never understood.
Re: Winsock - Send/Recv stacking information?
You don't. TCP ensures the packets arrive in order, UDP does not.LunaRebirth wrote:On the part about UDP, Would you happen to know how to use Winsock for UDP and TCP at the same time? I've looked it up before, but never understood.
- The glory days.