I need the same application on a Web server to handle both handling web page get or post requests ( securely) as well as talk to a remote application using a listening TCP or UDP socket. For example, a web page action may prompt fetch of data from the socket connection. Another web page action may trigger sending a packet on the socket connection. The program will need to authenticate the remote application connecting on the socket and handle updates to a database based on that and web page activity as well. What is the best way to go about this? I am limited to Windows but will have a dedicated server for this activity. This will be development not demo so reliability and redundancy not too important now. Thanks. I see you can do both, but can I just have a constantly running looping application in PHP handling both rather than through .php files initiating the application only on browsing activity? My feet aren't wet yet as you can see. I just want to confirm before I get in.