By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,509 Members | 1,307 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,509 IT Pros & Developers. It's quick & easy.

Problem with asynchronous HttpWebRequest

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.