james williams

james williams

  • NA
  • 6
  • 15.8k

Threads, Sockets & PHP

May 24 2011 9:00 AM
Hi All,

I have a threaded winform application that connects to a service (i do not control. we will call it "uber-service") via tcp sockets.

Now i want to create a PHP driven web front end (as this is to be hosted on linux servers)

I have had some successful tests using php sockets. The issue is PHP will close the socket after each request. 

The way i thought of getting round this was maybe on the first connect send a new Guid that the PHP side can save.

Would it be possible to say:

1) On first connect from PHP send guid
2) Create new thread and connect to "uber-service" and maintain a connection. Save thread in a static Dictionary<Guid, Thread> 
3) On next connection from PHP if received Guid, Load thread associated and do what message PHP has sent?
...
...
... 

If it is possible can anyone see any downfalls? 


Thanks!!!

James

Answers (1)