I am developing a turn-based game in C# that uses a PHP server. I have created a series of small PHP scripts that do all the necessary server processing. I am trying to determine the fastest way to connect to these scripts. Obviously, I can just use a WebRequest
to execute the script, but I was wondering if using sockets would result in a faster transfer, ignoring the time it takes to execute the script.
Should I use WebRequest
(simple), or use sockets (more complicated)?
Short answer: No.
Long Answer: the WebRequest object already has all the code you need to communicate with a web server application. As long as your PHP code is being served up by a web server, the WebRequest is your best option. You could write a bunch of code using Socket objects to communicate with your web server, but you would wind up spending a lot of time writing a half-baked WebRequest object.