How can I send a string from php page to c# windows form using socket? Can you give me some example?

Develop a php page that returns a plain text string. And then request that URL in C# windows application using webrequest class.

Sample code is here: http://ask4asp.net/post/2009/05/13/fetching-URL-contents-into-a-string-using-HttpWebRequest.aspx

Above code is stated to retrieve the html content of the URL submitted in the argument. As your php file will return only the string, you can directly save it and then use it in your further processing.

SuperErik,

Use classes from System.net namespace - WebClient

thanks for the help.
the problem is the opposite.
The c#application interact via serial port to a modbus device and do a lot of stuff (monitor temperature, save data to db, .....) all works ok.
The php app need to execute a command on the c#app. For example a user can stop monitor tempertaure sending a string "STOP" to c#app throught socket next i can parse the string and do the designated method.
I don't know is the better mode to do what i need.
Thank again

examine the attached example, run both the server and the client solution at the same time and you will understand what is it all about.

I think you are looking for comet.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.