1

I have written a C# server which listens for Tcp connections. A client can connect to the server and send data, mostly filenames. The data that the server receives needs to be shown on a website written in ASP.NET.

I was thinking of using pipes to send the data from the server process to the website. Is this the right way to do it or are there other (smarter) ways of doing this?

Carlito
  • 805
  • 10
  • 20

2 Answers2

1

I don't think pipe are an option since the process hosting the website ( the worker process ) can be recycled at any moment and you dont have control on this. Is better to have a plain old database to share information between your service and the asp.net app. If you think the db is too much, you can use a plain file ( or an xml does not matter ) but in this case you have to keep an eye to the concurrency since both process can concurrently try to open the file.

Felice Pollano
  • 32,832
  • 9
  • 75
  • 115
  • Using a db or a file is an option, but the website needs to get notified. The idea is that a user clicks some button, server sends request to client, client sends data back to server, server sends data back to the website. I'm not sure how to notify the webpage if there is data ready in a db or a file. Any ideas? – Carlito Oct 11 '11 at 09:45
  • You could to use `FileSystemWatcher` to monitor a file, a `SqlDependency` to monitor a table or just a "Click here to refresh", where you run a query over that database and look if that file is already available. – Rubens Farias Oct 11 '11 at 09:51
  • Thank you, didn't knew about SqlDependency. I might check that one out! – Carlito Oct 11 '11 at 10:08
  • Maybe the FileSystemWatcher would be the easyest solution, but the DB one is in order to me the safer. – Felice Pollano Oct 11 '11 at 10:15
0

You can write a WCF service which can talk to client/server and website on different protocols.....

Vijay
  • 46
  • 2