mbuchetics
mbuchetics

Reputation: 1420

HTTPListener (or alternative?): keep connection alive

I have two applications communicating using a HTTP protocol. One application uses a HTTPListener to receive data from the other. This works quite well. Due to the fact, that it's usually only the two applications communication, I would like to keep the connection alive for as long as possible. The KeepAlive property of HttpListenerRequest is set to true (this is the default) but the connection seems to get closed once I send the response.

I can not find any settings for HttpListener such as time outs etc. Is this even possible with this class or are there any more suitable alternatives available?

Upvotes: 0

Views: 1865

Answers (1)

Aliostad
Aliostad

Reputation: 81700

Timeout is a client thing - whoever requests waits for a timeout.

KeepAlive is an optional header which requests to server to keep the connection alive while server is not obliged to. This keeping alive spans multiple requests which I believe is not what you are after.

Behaviour you are after can be achieved by chunked encoding.

have a listen to this podcast you will get all answers.

Upvotes: 3

Related Questions