Thread: UDP server-client

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    224

    UDP server-client

    what is the best way to have a server talking to many clients 20-30+ at the same time (mmorpg style) and still update info such as were enemies are and what not.. while constantly getting info from and sending info to clients...?? i hope you understood this

    EDIT:: i was thinking of something like the select() func for TCP but i dont know if that will even do what i want it to.

    thx for any help
    Last edited by c++.prog.newbie; 09-07-2005 at 07:32 PM.

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    Select works on UDP sockets as well.
    Simply have an event loop wait on data from a socket, then send the appropriate updates to the appropriate sockets. This may require doing it in more than 1 select call. For instance your kernel may not be able to send to all the sockets in one shot so you'd hav eot go back to selecting until you can write to the socket again.

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    224
    but i cant have blocking sockets or else the game wont run smooth.. seeing as how the server has to update stuff like NPC locations and whatnot

  4. #4
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    So don't? What is the hard part here?

  5. #5
    Registered User
    Join Date
    Oct 2001
    Posts
    224
    oh ya i just remembered select doesnt block unless you want it to! lol

  6. #6
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    Yes, documentation is a powerful concept.

  7. #7
    Registered User
    Join Date
    Oct 2001
    Posts
    224
    does anyone know what the best format to send info is for a game... if i remeber correct there are many data types that can be sent.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. server client application - (i really need your help)
    By sarahnetworking in forum C Programming
    Replies: 3
    Last Post: 03-01-2008, 10:54 PM
  2. Using select() for client UDP
    By jazzman83 in forum C Programming
    Replies: 2
    Last Post: 04-03-2007, 05:31 AM
  3. Where's the EPIPE signal?
    By marc.andrysco in forum Networking/Device Communication
    Replies: 0
    Last Post: 12-23-2006, 08:04 PM
  4. Unicode vurses Non Unicode client server application with winsock2 query?
    By dp_76 in forum Networking/Device Communication
    Replies: 0
    Last Post: 05-16-2005, 07:26 AM
  5. UDP Server -> Displaying Client Information
    By Jedimark in forum Networking/Device Communication
    Replies: 6
    Last Post: 12-05-2003, 12:57 PM