I have a basic Ubuntu virtual machine set up here in our office (Ubuntu 12.04) with a basic LAMP stack installed.
I wrote a PHP socket server using socket_create. See code:
$this -> master = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or die("Failed: socket_create()");
socket_set_option($this -> master, SOL_SOCKET, SO_REUSEADDR, 1) or die("Failed: socket_option()");
socket_bind($this -> master, $addr, $port) or die("Failed: socket_bind()");
socket_listen($this -> master, 20) or die("Failed: socket_listen()");
All seemed good. We can ping the server locally and get less than <1ms ping times, but when we use Chrome’s new WebSocket javascript API, we’re getting messages consistently sent and received at 500ms apart. Literally like 497, 501, 503, 500ms, etc.
Any suggestions what could be causing this?
Turns out it was the ESET Smart Security firewall protection. Disabling the “HTTP/HTTPS Scanner” immediately caused the speeds to drop down to 60ms like they should have been!