Threading, and Sockets.

Added support for Threading and Sockets. I also made a PHP script to
communicate with the script and it seems to be working partially.