?
Solved

HttpWebRequest - Using to submit time sensitive request.

Posted on 2002-06-26
8
Medium Priority
?
433 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
  • 4
  • 2
  • 2
8 Comments
 
LVL 20

Accepted Solution

by:
Michel Sakr earned 1540 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:Michel Sakr
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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
LVL 20

Expert Comment

by:Michel Sakr
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:Michel Sakr
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month15 days, 1 hour left to enroll

840 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