PDA

View Full Version : Best Socket server


majicassassin
08-03-2007, 01:10 AM
So with the coming of the XMLsocket (maybe I missed it being included earlier) in flash, we have a world of possibilities... but I have no idea what language I should make the actual server. Languages I'm considering are:
PHP (yeah, it does socket servers)
Java
C++

I'm really not a fan of Ruby and PERL, but have seen them before.
Reason I want to do PHP the most is because I want to make a game that is database access heavy, and I already have tons of accessors from previous projects in PHP.

But, I can't find any benchmarks comparing allf them (well, I'm told Ruby cuts out around 1000 active connections). Does anyone know a good place I should start looking?
Thanks!
maji

evride
08-07-2007, 08:29 AM
they've been included for awhile now.
i know some java ones claim to unlimited connections. don't use perl or c++. its too resource heavy. i dont know much abou ruby.

you might want to check out the ones already made. theres free and opensource ones. electro server and SmartFoxServer are commercial but have a lot of documentation.

jsebrech
08-07-2007, 01:05 PM
I'd stay away from the page-based languages (ruby, perl, php), since they're likely not to be very well suited to the socket model. I'd also stay away from C++, because you'll end up having to reinvent too much stuff. If I was going to write a socket server I'd pick java, but I guess it depends on what you're most comfortable with.

majicassassin
08-07-2007, 11:43 PM
Ahh, thanks... I looked into the open source ones, they're not really brilliantly designed for games...
I started working in C++, I have a basic chat server, but you're right, it takes a while to do not much. I may end up switching to java :(
(I'm not sure what you mean about C++ being resource heavy... it runs much lighters and faster than almost any other language...)

jsebrech
08-08-2007, 08:22 AM
C++ is definitely not resource heavy, it's lighter than all of the alternatives (except plain C, which nobody in their right mind would use for this). It doesn't matter though, because we're not speaking of an order of magnitude difference. Pick whichever language lets you write the thing most easily, and don't worry about performance. Performance problems you solve with good architecture, not with efficient compilers.

evride
08-08-2007, 09:04 AM
well i read that Perl and Python were resource heavy. and them being CGI languages i expected C++ to be too.

majicassassin
08-08-2007, 04:04 PM
Ahh, I see. I think you're right in CGI being in general is resource heavy, but I think you can sidestep that with C++, since you don't actually need anything except itself to setup a socket interface with the outside world.

sneakyimp
08-09-2007, 06:46 AM
I have written a simple socket server in PHP. The kicker is that your socket server has to run as a daemon - meaning you have to launch it from the command line or on bootup or thru a cron job or something.

PM me if you want the source. I want this project to be open source and could use testers/developers/feedback.

jsebrech
08-09-2007, 10:06 AM
What kills performance on CGI is that the executable (php, perl or your c++ app) has to be launched for every request to the web server. It has nothing to do with the language used. Besides, you can easily sidestep this by using FastCGI, which instead of starting the executables up when the request arrives starts them up in advance, and keeps them running to be reused afterwards. It's trivially easy to integrate FastCGI with a C++ CGI app.

sneakyimp
04-02-2008, 09:44 PM
The socket server I wrote is intended to run as a daemon. You have to start it from the command line but once you launch it, it stays running.
http://flashmog.net

I hope to have the AS3 version up shortly.