Jump to content

Multi-threading for update server?

- - - - -

  • Please log in to reply
3 replies to this topic

#1
bbqroast

bbqroast

    Codecall Addict

  • Members
  • PipPipPipPipPipPipPip
  • 554 posts
  • Location:/etc/passwd
I am working on a update server that will be connected to by the launcher for my program. My current idea is to loop constantly picking up each connection request (TCP) and then comparing the client's version with the server's version.

Now once the server has confirmed the client needs updating I have three possibly routes:
1. An array of connections, each loop the server sends part of the file to them (size will be determined by the amount of players and the servers upload speed).
2. A web address (possibly secured by making the address a PHP page which requires a unique ID before it gives the client the file? A list of unique IPs that had been issued would also be involved) which the server gives to the client and then the client can download the new EXE from there?
3. The server spawns a new thread to do the task.
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).

#2
Flying Dutchman

Flying Dutchman

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 889 posts
  • Location:::1
I would create an event for each successful connection, and then compare client's and server's version. Then, if versions don't match, you could send back the file or address where to get it.
A conclusion is where you got tired of thinking.
#define class struct    // All is public.

#3
bbqroast

bbqroast

    Codecall Addict

  • Members
  • PipPipPipPipPipPipPip
  • 554 posts
  • Location:/etc/passwd
The issue is I assume that the functions in SDL_net hold up the program until the file is sent?
Thus I would need a loop of some kind...
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).

#4
Flying Dutchman

Flying Dutchman

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 889 posts
  • Location:::1
Yea, it's quite possible that sending data to one client will put others on hold. I don't have much threading experience, but I'd say you need at least 2 threads, 1 to check for incoming connections and 1 to send data back.
A conclusion is where you got tired of thinking.
#define class struct    // All is public.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users