jimplode jimplode - 1 year ago 88
C# Question

Server side technology for streaming to async webrequests

I need to write a C# application that will sit and run as a service on a windows server.

This application will be responsible for sending JSON snippets to connected clients.

Clients will be connecting using an Asynchronous WebRequest and I want to Gzip encode the payloads to reduce the size of the packets being sent down the wire to each connected client. The data being sent to each client will differ so I need to manage all the connections as well.

Once a client is connected, they will remain connected for as long as possible, so the server will be sending heartbeats every x number of seconds.

I have not done programming like this since my days back in uni and wondered what the best way of achieving this was?

Can I use Sockets and standard TCP/IP with the WebRequest connection method?

Answer Source

I went with the HttpListener in the end.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download