Jump to content
Tuts 4 You

Make http connection accessible in server busy mode


Rajesh

Recommended Posts

Posted

I want to access a site (third party, I do not have any server side access) via Httpwebrequest in c#. All works well but I want to access the site most at a certain time of the day, for 4-5 minutes. But this time the server flooded by user requests and server responds very slowly.

The time is almost fixed, that is when I want to get contents from it.And it gets inaccessible for that time due to loads of user hits.

Is there any technique, that can maximize my chance to get response from that site when it even gets busy? I search a lot but found nothing. If you could help me, I would be grateful. Thanks guys.

I'am Adding request and response header for your further understanding

Request Headers
--------------------
Connection:    keepalive
Accept-Encoding:    gzip,deflate
Accept:application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
User-Agent:Mozilla/5.0 (Windows T 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36
Content-Type:application/x-www-form-urlencoded
Cookie: JSESSIONID=mWYJWy6TDfTLxJSTG8kWYgl1gLmjKvXrXQxFKwPcQTWgMSn1HlyH
Content-Length:652

Response Headers
-----------------
(Status-Line):    HTTP/1.1 200 OK
Cache-Control:    no-store
Content-Type:    text/html; charset=iso-8859-1
Server:    Microsoft-IIS/7.5
SET-COOKIE :JSESSIONID=mWYJWy6TDfTLxJSTG8kWYgl1gLmjKvXrXQxFKwPcQTWgMSn1HlyH
X-Powered-By: Servlet/2.5 JSP/2.1
Date:    Thu, 17 Dec 2015 04:30:44 GMT
Content-Length:    12467

 

 

Posted

Dear #kao Any suggestion on this topic.

 

Posted

Welcome to the programming section.

You're getting a ~12kb response - the connection is alive. On slow connections 12kb is probably not going to make it through in 1 piece. How many seconds is slow for you?

If you could post your host here I could tell you if it is indeed slow or not.

I'd recommend to not use the low quality MS API's. They're famous for being slow. Libs that allow you to control the underlying socket are ideal, specifically the select() timeout value on the nonblocking socket.

Is it your DNS server that's getting overloaded? Perhaps a router/switch/etc in route of the client-server connection that's causing some bottleneck? Maybe a bug in your client code?

I'd verify this using netcat, telnet, traceroute, DNS lookups, etc first.

You have to answer all this before being able to optimize your client code. In my experience even the slowest servers on slowest connections can get a response back inside of 20, 25 seconds, for http at least.

In the case that the host is truly at fault (which for me has never happened), all you can is use a HTTP proxy that's geographically closer than the client is.

Posted

Bump, interested in solution as well.

Posted

Raj after searching ur skype u sent me I see u made a few accounts around here haha ; )

the sh!ttyness of MS networking API's is well known & documented, switching to an actual HTTP lib will probably solve ur problems w/out having to hire someone.

Posted

What about having a HTTP proxy? It can solve a lot of mysterious issues concerning speed and accessibility. Even set it to localhost with some port number will work sometimes.:)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...