473,473 Members | 1,489 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problem with asynchronous HttpWebRequest

Hi,

I'm having a problem with asynchronous HttpWebRequest. It's a simple
http client-server. For most of my users it works fine. However, some
of them get the exception:

System.Net.WebException: Unable to connect to the remote server --->
System.Net.Sockets.SocketException: The attempted operation is not
supported for the type of object referenced
at System.Net.Sockets.Socket.get_ConnectEx()
at System.Net.Sockets.Socket.BeginConnectEx(EndPoint remoteEP,
Boolean flowContext, AsyncCallback callback, Object state)
at System.Net.Sockets.Socket.UnsafeBeginConnect(EndPo int remoteEP,
AsyncCallback callback, Object state)
at System.Net.ServicePoint.ConnectSocketInternal(Bool ean
connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress&
address, ConnectSocketState state, IAsyncResult asyncResult, Int32
timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse(IAsyncRes ult
asyncResult)

My code is:

Uri url = new Uri(getURI());
m_request = (HttpWebRequest)WebRequest.Create(url);
m_request.Credentials = CredentialCache.DefaultCredentials;
m_request.UserAgent = getUserAgent();
m_request.BeginGetResponse(new AsyncCallback(ProcessResponse), null);

and then:

private void ProcessResponse(IAsyncResult asynchronousResult) {
HttpWebResponse response =
(HttpWebResponse)m_request.EndGetResponse(asynchro nousResult);
Stream stream = response.GetResponseStream();
....
}

This is so weird.
Any ideas ?

Thanks!

Feb 7 '06 #1
1 3350
Is it a normal "http://server/" address?

Are you using IPSEC?

It's possible the tcp/ip registry settings could be corrupted...
http://support.microsoft.com/kb/811259
Hi,

I'm having a problem with asynchronous HttpWebRequest. It's a simple
http client-server. For most of my users it works fine. However, some
of them get the exception:

System.Net.WebException: Unable to connect to the remote server --->
System.Net.Sockets.SocketException: The attempted operation is not
supported for the type of object referenced
at System.Net.Sockets.Socket.get_ConnectEx()
at System.Net.Sockets.Socket.BeginConnectEx(EndPoint remoteEP,
Boolean flowContext, AsyncCallback callback, Object state)
at System.Net.Sockets.Socket.UnsafeBeginConnect(EndPo int remoteEP,
AsyncCallback callback, Object state)
at System.Net.ServicePoint.ConnectSocketInternal(Bool ean
connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress&
address, ConnectSocketState state, IAsyncResult asyncResult, Int32
timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse(IAsyncRes ult
asyncResult)
My code is:

Uri url = new Uri(getURI());
m_request = (HttpWebRequest)WebRequest.Create(url);
m_request.Credentials = CredentialCache.DefaultCredentials;
m_request.UserAgent = getUserAgent();
m_request.BeginGetResponse(new AsyncCallback(ProcessResponse), null);
and then:

private void ProcessResponse(IAsyncResult asynchronousResult) {
HttpWebResponse response =
(HttpWebResponse)m_request.EndGetResponse(asynchro nousResult);
Stream stream = response.GetResponseStream();
...
}
This is so weird.
Any ideas ?
Thanks!

Feb 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: news.microsoft.com | last post by:
Hello I try to implement "retry" if connection to web ends with "time out". I want to give a chance to prolong waiting for response. The following code is taken from WebRequest.GetResponse()...
1
by: Sojwal Chitnis | last post by:
Hi, We have a asp.net web application in which we are making HTTP requests to a remote web server (CGI) & get response in form of XML data. We are using HttpWebRequest object to post the...
4
by: Dave | last post by:
I've have several webrequests being called consecutively from an .aspx that return XML from sources outside the company. When the page runs it can take anywhere between 30-60 seconds. I heard...
0
by: davidpenty | last post by:
Hi there, I am having some problems with a multi-threaded asp.net seach page. My search page sends off four asynchronous http requests to four search engines then waits for the results to come...
2
by: Giulio Petrucci | last post by:
Hi everytbody, I'm experiencing some problems trying to asynchronously read data from a Socket object. What I do now is: 1) call th BeginReceive(...) method on the Socket object; 2) within the...
4
by: MaxMax | last post by:
I'm using HttpWebRequest. It seems that all the callback called from HttpWebRequest are in another thread (not in the "original" thread). Now my problem is that the "original" thread is the thread...
0
by: Morgan Cheng | last post by:
In the doc http://msdn2.microsoft.com/en-us/library/system.net.httpwebrequest.timeout.aspx, it reads, "A Domain Name System (DNS) query may take up to 15 seconds to return or time out. If your...
0
by: APA | last post by:
I've seen the MS sample async web request pattern and I ask is it really async if it is using a ManualResetEvent and setting WaitOne()? The ManualResetEvent object is being declared as a static...
1
by: sindhurasingeetham | last post by:
Hi, I'm new to coding in .NET. I am trying to do an asynchronous call in my code using httpwebrequest. This code works perfectly fine on one server, but does not work on another. The main flow...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.