Sign in to follow this  

Problem with package managing?

This topic is 4352 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hollo! First off all sorry for my poor English :) OK, I am trying to crate a multiplayer game server. I know how to program sockets, channels, etc but I have a problem with the managing of the packeges. The Situation: I have one socket (UDP) for the clients. All clients connect to it and each one get one channel. So I am able to send a package to one Client. But I am not able to get a package of one particular client. My plan was this: while(running) { get all stuff in the buffer calculate positions, frags, ... save new posistions, ... in one packate send the package to all clients } I think so far it's ok, but when I get the packages from the buffer it may be that some clients have send many packages but others none. For those of them who sent none I will use the old one (later: maybe calculate the new position with the old data). For those who send more than one I will only use the last one. Now my question: Might be there any Problems?

Share this post


Link to post
Share on other sites
When you say "channel," that has to be some construct that you implement yourself. UDP itself does not have this construct. How do you derive the channel a packet is from, when it comes in? Or is that what your question is about?

For UDP servers, the typical thing to do is to use recvfrom(), and to use a hash table from remote IP address/port to server-side client ID (or, in this case, "channel"). When you receive a packet from some address you haven't seen before, chances are it's a new client wanting to connect, so you'll need to allocate a new channel for it.

Share this post


Link to post
Share on other sites
OK, sorry!
I forgot to say that I am working with SDL_Net.
A Channel is only one client which is identified by the ip and port.

But SDL_Net hast no function like recvfrom().
Here is the list of the functions maybe I overlooked something:
http://jcatki.no-ip.org/SDL_net/SDL_net_frame.html

Share this post


Link to post
Share on other sites

This topic is 4352 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this