473,409 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

Bind HttpWebRequest/-Response to a specific stream?

2
I'm implementing a propiertary protocol for a company which is actually an extension of HTTP (extended with some specific headers). If I use the .NET class HttpWebRequest and HttpWebResponse respectively I can easily communicate with the server by setting the necessary headers.
Since any further requests/responses should be sent over the connection, established after the first request, for receiving events from the server, I have to left the stream in HttpWebRequest be opened (I cannot change the server application).
Unfortunately the stream by calling the method GetRequestStream is closed after one request/response.
The KeepAlive property is also not an option, since the server has to be HTTP/1.1 compliant for that to work and it will break the connection somewhere in time (even on non-fatal errors).
My question if there is a change to introduce something like a method "SetRequestStream" into a subclass of HttpWebRequest for example to specify which stream has to be used for the connection.
But I doubt that this works since one has no access to the socket-level in the class HttpWebRequest. Using the source code (ROTOR project) of HttpWebRequest is also not an option since this application is going to be commercial.
I hope someone has some useful ideas...
Jul 20 '07 #1
1 1426
Plater
7,872 Expert 4TB
Implementing HTTP at the socket level really isn't all that bad.
I've been working on the server side of it for awhile now.

See the RFC for HTTP to make sure you follow at least minimal implementation standards.

HTTP/1.0 is really really simple since it's without much of the headers.

For example in HTTP/1.0 you can get away with:
Expand|Select|Wrap|Line Numbers
  1. "GET / HTTP/1.0\r\n"
  2.  
as a valid request
Jul 20 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Dan Battagin | last post by:
Is there a known bug with the interaction between the HttpWebRequest and the ThreadPool? I current spawn several HttpWebRequest's using BeginGetResponse, and they work for a while, using worker...
9
by: Mike Cronin via DotNetMonster.com | last post by:
Hi there, Can anyone tell me what level of encryption is used when making an HTTPS POST request through an instance of the System.Net.HttpWebRequest object? Thanks much in advance! Mike...
3
by: EMonaco | last post by:
Is there any way to programmatically select a particular client certificate and associate it with an HttpWebRequest instance? I know using WinINet this was possible. Erin.
16
by: thomas peter | last post by:
I am building a precache engine... one that request over 100 pages on an remote server to cache them remotely... can i use the HttpWebRequest and WebResponse classes for this? or must i use the...
0
by: Cozfer | last post by:
I am having a problem communicating with a remote server (on intranet) using the httpwebrequest object. We have used the object to communicate with other machines previously, but this time we must...
6
by: Mike Koerner | last post by:
Hi, I am having problems setting the HttpWebRequest Date header. I understand that it is a restricted header and I do receive the "This header must be modified with the appropriate property." ...
5
by: Not4u | last post by:
Hello, Someone is using HttpWebRequest to automaticly post datas or retrieve datas from my site. How can i stop pages to be get by the HttpWebRequest method ? I know that pages get with...
6
by: James MA | last post by:
I'm now writing a small program to communicate a web server to simulate a web client. I use te httpwebrequest to talk with the server, and it works find for "POST" method, however, when i test...
3
by: JansenH | last post by:
We have implemented a 'HTTP Post' client in C# that posts Xml documents to a webserver. This is working fine if the post rate is one post for every 20 seconds. But if the post rate is increased to...
12
by: Mark Rae | last post by:
Hi, The following code works: HttpWebRequest objRequest = null; try { HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create("http://www.microsoft.com"); using (HttpWebResponse...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.