Dataexchange between a C # server (not a web server) and PHP

I have a constantly running Serverprogram (C # /. NET 2.0 on Linux with mono), and I want to connect to it using PHP Script to display status information on the website.

The goal is to create (sort) a Realtime Browserame (No Flash, no Silverlight), and I want to use PHP Script to get the necessary information from C # GameServer, that is, the current device positions, player resources, rating, visible map, etc. .d. Information is updated every second or even faster, but actions can take hours or even days (for example, a study can take a week)

Are there libraries that allow me to easily transfer information between these two parts of the program?

My thoughts:

  • Using the embedded WebServer and connecting via PHP SoapClient.
    Does anyone have experience with the free built-in WebServer (for free, because the game will be free)?

  • Socket Programming and passing JSON / XML / SOAP blocks.
    Are there any simple libraries for this type of network connection for PHP / C # that are automatically read from the socket until the message is completed and then sends an event to the game controller?

  • Just dump for each user and global data to a database or to xml files
    A simple solution, but imho is not scalable enough.

What would you suggest?

Thanks in advance.

Supplement for others having a similar question:

After a little research after posting this Question, I came across a .NET System.Net.HttpListener, which is even mono supported, so I will use it now. It seems to have everything you need to embed WebServer on your server.


+4
source share
2 answers

I would use a simple built-in web server and just use the PHP Curl extensions to interact with it http://php.net/manual/en/book.curl.php . For the embedded web server, I would start looking for code, for example. http://www.codeplex.com/webserver .

+1
source

Just start a simple server on a C # server, connect to it from your client (PHP) through a socket. You will need to write โ€œrulesโ€ for interaction, but you can avoid the overhead associated with JSON / SOAP, etc. Another solution is to use an XMLRPC server.

+1
source

Source: https://habr.com/ru/post/1300294/


All Articles