c# 3.0 - HttpListener prevent Timeout -
i implemented httplistener
process soaprequests. works fine can't find soloution problem, soap-requests take time, resulting in timeouts on client side.
how let requesting client know, request not timeout?
i thought sending "dummy"-information while request gets processsed, httplistener seems send data when close
response-object, , can done once, not right thing suppose.
soloution:
thread alliveworker = new thread(() => { try { while (context.response.outputstream.canwrite) { context.response.outputstream.writebyte((byte) ' '); context.response.outputstream.flush(); thread.sleep(5000); } } { } }); alliveworker.start(); dowork(); alliveworker.interrupt(); createtherealresponse();
sending dummy information not bad idea.
i think need call flush()
method on httplistenerresponse
's outputstream
property after writing dummy data. must enable sendchunked
property:
try sending dummy space @ regular interval:
response.sendchunked = true; response.outputstream.writebyte((byte)' '); response.outputstream.flush();
Comments
Post a Comment