   simple game Internet server: C++ vs. PHP
  Hey guys and girls :)It's about casual game similar to GO. Players make moves by turn, so traffic is quite low. Network (LAN, client) part is(will be) based on Winsock2.There're two options for the Internet game server (as I see):1. based on win32 c++ code2. based on PHP scriptsI'd like to propose to talk about up-/downsides of both approaches for the current sittuation.The most obvious thing is that PHP hosting is cheaper/easier to find. But what about development, server stability, limitations, possibilities etc.Thanks a lot!   
  It's very hard to build reliable persistent state using PHP. You end up creating a database transaction per move, and you end up having to poll to find out when the other player makes a move, which ends up being a significant load on the server, which in turn ends up making cheap hosts kick you out.If you're OK with requiring users to set up port forwarding, then I suggest you use a PHP script for lobbying, and then do peer-to-peer connections for the game. If not, then you'll need to host a persistent server, which means some kind of persistent server set-up.One option that's affordable is to set up a 250 MB virtual Linux slice with a hoster like DreamHost. $10/month for the web hosting, and $25/month for the virtual slice makes for $35/month for a permanent server. (If you decide to go that route, you can use promo code "L33TN3SS" to get $50 off the first year, and a free domain registration). Once you run out of capacity for that slice, other options are Amazon ECC, where hosting starts at about $80/month plus bandwidth, or something like serverbeach.com, where the bottom-of-the-barrel offers are about $70/month.;hplus0603, thank you very much for your answer and promo code.I'm not experienced with network technologies. What is a 'persistent server'?In case to have php server for lobby only.. Is it possible to connect two players which are both behind NAT then? Peer-to-peer connection would not work for all players, as I see.(this is what you meant by port forwarding?)And please tell what do you think about PHP + socket. Will it work on usual hosting?It seems that I will learn how to program on Linux soon :)   ;  A persistent server is a program/process that you write, and that runs continuously -- not just in response to a single web request, like a PHP script in a web server. You *can* write a persistent server in PHP, but you generally cannot host such servers on regular web hosts, because they do not allow long-running processes.To do NAT punch-through, you need an introducer process, which in turn needs to be a long-running (persistent) process/server, so again no dice with typical web hosts.Quote:It seems that I will learn how to program on Linux soon :)You can write a persistent process on Linux or Windows (or Solaris, or whatever). However, the servers you can lease for Linux are generally cheaper than those for Windows.   