Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 07 Nov 2002
Offline Last Active Dec 17 2014 02:05 PM

Topics I've Started

TCP clients-servers-servers

11 December 2014 - 03:46 PM

I am just thinking of how I should be architecting a server in which it has to serve clients, and also able to receive requests coming from other servers.  My network programming experience is limited, so I am having problem picturing this in my mind.


Clients connect to the server, and maintain active TCP connections.  In the application code level, this is represented by an object or some handle.  Other servers will talk to this server, and each will also have its own active connection objects. 


Suppose there is a scenario in which another server sends a command that should be broadcasted to all (or perhaps select) clients. Does this mean that the application code will have to iterate through all the client connections, pick the relevant (or all of them) clients, and broadcast the message?


This also means that the application code can only exist in one beefy box.  Clustering them into several boxes with a load balancer does not seem to be a good idea, as the clients connections will be spread out throughout the boxes.  Does this sound correct?  How do MMO servers handle thousands active connections?

Microsoft shy away from Windows

25 April 2014 - 11:06 AM



Obviously this is all speculation, and no solid proof yet that Microsoft invests less on Windows.  But what do you think if it were to come true that Microsoft now focus only on cloud services?  It's kind of like the same move IBM made when they decided to move away from hardware to consulting.


It's possible that they want to move away from PC desktop OS market, although financially that wouldn't be a smart move.  Windows is still being used by majority of people.



Funny quote from the video:


Users spending nearly 5 hours per day on the console!...Do people work on this country?




Server-side technology to handle time-based games

24 August 2013 - 06:50 PM

I am thinking of writing a server-side app to support social gaming.  You can identify one common feature in many social games and that is they utilize real-life time as part of the gameplay.  For example, in FarmVille, you plant and water crops and after 8 real-life hours, you can harvest them.  Some of these timing can be as long as 24 hours, some others are as short as 1 minute.


I want to try making a server that can handle this feature, and I have two options:

  1. Lazy Server / Active Client.  You store the time when a task (i.e harvesting a crop) should be completed by in the database server.  When a client loads up, it will get that time, and display the countdown timer from the client-side.  When this timer elapses, client does a POST to the server indicating that this particular crop should progress to the next state.  This moves all the processing power to the client side, and so server becomes dumb and only stores the time.  This has some issues:
    1. Cheaters and Hacking.  If someone figures out what data to send to the server, anyone will be able to cheat.  This is very easy to do with wireshark and netstat.
    2. Activities are disabled when players are offline.  There are games where that allow a player to interact with another player even when both players are offline.  For example, in a game like Travian, a player can attack another player.  Based on the distance of their villages and the unit types, the server calculates how long till the attack actually happens.  Even when both players are offline, the attack is still happening.  The accuracy of this game is down to seconds.  This is not possible with this option.
  2. Server to continually keeps tabs of all the activities across all players, and update the timing accordingly.  This seems to be the right thing to do.  It prevents malformed requests from messing with the game, and it also allows certain activities to be executed even when players are offline.  I don't have much experience dealing with server-side technologies, would cron do the job for this?  Is cron effective in handling timing jobs from millions of players?  If not, what would the be ideal program to handle this? Should I make my own app that continually update the database?

StackOverflow-style markdown

11 February 2013 - 02:11 PM

Would it be hard to do to make composing posts use StackOverflow markdown?


If I want certain keyword to use fixed-width font, I'd use the backtick character.  So if I do this:


Do not use `cin` to print a text


It would output to:


Do not use cin to print a text



It'd be nice to not use this Word-style toolbar for editing posts.  It's very limiting.

What's the proper name for this class?

09 February 2013 - 05:11 PM

I'm writing a class that inserts/updates or deletes records to a database table.  I can't come up with the proper name for this class.


DBInsertor? Sounds pretty stupid.


DBRecord?  It's ambigous as it doesn't represent any DB record or model.


DBRecordKeeper?  It doesn't keep or store records.


Any ideas?