views:

105

answers:

2

I was wondering if ASP.NET is more efficent than PHP with sockets. Ive frozen a server several times doing relatively few connections on PHP. I was wondering if any server side programming engines are capable of hosting a reliable and efficient socket server.

+1  A: 

Having never implemented a socket server in PHP, nor ever touching ASP.NET I can't comment on those.

I've seen many great socket applications implemented in Python. I recommend looking into Twisted.

I've personally played around with EventMachine (Ruby), and it's definitely a great little library to use. Their goal is:

Extremely high scalability, performance and stability for the most demanding production environments

Creating a server with EventMachine is as simple as:

require 'rubygems'
require 'eventmachine'

module Echo
  def receive_data data
    send_data data
  end
end

EM.run {
  EM.start_server "0.0.0.0", 10000, Echo
}

You should be able to benchmark this pretty easily. It's a simple echo server.

hobodave
thanks for this, i hadn't really given much thought to python or ruby. i havnt touched ruby yet so maybe this is a good time to try
Samuel
+1  A: 

A word of caution with php: AFAIK threading is not enabled by default and so getting this run efficiently will be one extra step for you. No idea about ASP.NET on this.

I'm currently in the middle of doing the exact same thing and had a couple thousand lines of php sockets code written before deciding to move over to c++.

Travis