I am running an application via a videogame environment (Unity, which is basically a C# library), on my Android device. I would like this application to respond to commands from my PC (preferably running Windows 8 but can be Linux:Ubuntu if easier). The device and the PC are on the same LAN, but are not attached by a physical cable. I need the device to respond to commands from the PC within 0.5 seconds of the command being issued.
Question: what is the easiest (conceptually and practically) way to establish such a connection between my PC and my device?
Sample scenario: I am running a game on my Android phone where spiders are crawling on my screen. When I hit space on my computer, I want all of the spiders to be swatted away.
Current solution: create a ruby-on-rails website & database. When a command is entered on the PC, the database is updated with the command. Every 0.5 seconds, the device checks the timestamp on the database and pulls any new commands. This solution is sub-optimal because I do not know ruby (I am willing to learn it, but I would like an easier solution).
Should I use C# sockets for this?
I would love some simple code that, for example, would open a direct connection between my PC and my device that will allow me to send byte streams (for instance, my PC could send the string "spacebar was pressed").
I am very uneducated regarding networks and would appreciated simple explanations.