Solved

HttpWebRequest - Using to submit time sensitive request.

Posted on 2002-06-26
8
418 Views
Last Modified: 2012-05-04
  We are trying to build an app that posts requests to a website that need to be there as close to a certain hour as possible.  The app we have built will post request but the time lags as much as 5 secs after hour.  I notices that the HttpWebRequest has methods and properties that could be helpful if we could find some descent infomation about them.  i.e. BeginGetRequestStream Method,PreAuthenticate Property,Pipelined Property,KeepAlive Property ect...  
   I believe this could be used to send a request early and by then using the EndGetRequestStream Method completing the request at the desired time. I think this would eliminate some of the problems with hitting the correct time on the host server.  Is this possible?  Do you have any code examples?  
0
Comment
Question by:ChrisGrammer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 20

Accepted Solution

by:
Silvers5 earned 385 total points
ID: 7112801
This is not possible at all.. the IP packet routing and connection delays will render it impossible.. this is due also to the http protocole that is connectionless.. you will need to keep the data available a certain amount of time..
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7112839
You can only get an estimation and, like Silvers5 already mentioned, the sending and retrieving can take quite some time.

Why does it have to be one hour exactly? You already have the best approach you can get. However, for the first connect you can measure the time between the opening of the connection to the closure. Then use that time to create an even better estimation of the connect time. Howrever, this is not foolproof.

CJ
0
 
LVL 20

Expert Comment

by:Silvers5
ID: 7112849
>Then use that time to create an even better estimation of the connect time

Any connection delay will render this useless.. I'm facing the same issue now where I'm fetching XML data that gets updated in the last minute before getting deleted totally remotly for a new cycle...
0
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

 
LVL 20

Expert Comment

by:Silvers5
ID: 7112853
A sort of workaround is to create several applications that run in parallel and log to a same or several databases .. this way you can have more chances that one will hit the closest.. and you make a routine in the backround to keep the closest records, or your presentation layer will show the closest record...
regards
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7112887
Continueing where Silvers5 left:
You can indeed create a program on the server that stays connected with the database and does it's thing every hour. Then store the results temporarily in memory until the client needs that information (connect -> retrieve -> disconnect). You can easily simulate the users session by passing additional information in the querystring or session object.

Since the app is running on the same server you will hardly have any delay.

CJ
0
 
LVL 20

Expert Comment

by:Silvers5
ID: 7112908
I guess if he had controle over the remote server he could've done this already.. or have access to the db..
0
 

Author Comment

by:ChrisGrammer
ID: 7113340
Here is some more information about my delima.  We currently have an app that uses this approach to the problem.  I run several apps that submit the same reqeust. Each one send it's request at predetermined time. i.e. App1 starts transmitting its request at :20 sec (this is almost always extremely too early) before the hour. App2 :10 sec before ect.  Each App looks at the response received and sends another until it gets a hit on or after after the target time, or the app also stops sending if one of the other apps sets a flag letting it know that the target has been hit. Any hits before the target hour are invalid. I called it a 'sliding window approach'.  This method used to work very well, but lately a competitor has been able to hit the hour exactly with everyone else getting in as late as :5 secs later.  Additionally,  the security is changing to X509.  This is the reason for redoing this app.  On last thing, I was hoping to stretch the time out by a few seconds not an hour.  Send the a BeginGetRequestStream say :10 secs before and then Send the EndGetRequestStream 2 to 3 secs before the hour.  I might be off base but I know at least one competitor has figured out a better method. Previously, I tried a pinging approach. Thx for you interest.    
0
 

Author Comment

by:ChrisGrammer
ID: 7120386
Thx for your input.
0

Featured Post

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question