Home All Groups Group Topic Archive Search About

Strange Socket 10061 Error

Author
20 Jul 2006 8:22 PM
Ken Haynes
I'm trying to get the motion detector sample code running from Scott
Hanselman's "Some Assembly Required" entry here:
http://msdn.microsoft.com/coding4fun/someassemblyrequired/babies/default.aspx.

Very cool stuff, by the way.

I'm using Visual C# 2005 Express Edition to build the application. 

When I build and run the application I get an error when I try to connect to
my IP Webcam.  I can run it just fine, if I'm connected to a directly
connected USB webcam, but if I try and connect to an IP based webcam using an
System.Net.HttpWebRequest call I have problems.

I get a System.Net.WebException. 
Inner exception message:
"No connection could be made because the target machine actively refused it"
Inner exception native error code:
10061

The stack trace shows:
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,
SocketAddress socketAddress)
   at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure,
Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState
state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)

The problem is I can connect to the camera just fine with my IE browser,
it's only inside the Winform App that I get this problem.

I'm using Simon Fell's YATT trace program to help with the debuggin. When my
IE browser is connecting to the webcam, YATT shows the HTTP traffic just fine.

However, nothing shows up in YATT when I run the Winform App. That leads me
to believe the program is being stopped short of actually sending any data to
the webcam and throwing an error instead.

Oh, I don't have any firewalls or virus programs running when I am running
the program in the debugger, so they aren't getting in the way.

I suspect it may be a permissions issue with the program, but I don't know
how to begin to chase this down.  Does anyone have any suggestions or know of
a solution?  Could this be an issue with the Express Editions?

--
Friends don't let friends use dialup.

Author
21 Jul 2006 10:14 AM
Kevin Spencer
Can you show us the code that employs the HttpWebRequest? Have you tried
using it in any other way before?

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.


Show quote
"Ken Haynes" <KenHay***@discussions.microsoft.com> wrote in message
news:9C104029-4B74-4370-90E3-A86CF74CA0A7@microsoft.com...
> I'm trying to get the motion detector sample code running from Scott
> Hanselman's "Some Assembly Required" entry here:
> http://msdn.microsoft.com/coding4fun/someassemblyrequired/babies/default.aspx.
>
> Very cool stuff, by the way.
>
> I'm using Visual C# 2005 Express Edition to build the application.
>
> When I build and run the application I get an error when I try to connect
> to
> my IP Webcam.  I can run it just fine, if I'm connected to a directly
> connected USB webcam, but if I try and connect to an IP based webcam using
> an
> System.Net.HttpWebRequest call I have problems.
>
> I get a System.Net.WebException.
> Inner exception message:
> "No connection could be made because the target machine actively refused
> it"
> Inner exception native error code:
> 10061
>
> The stack trace shows:
>   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,
> SocketAddress socketAddress)
>   at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
>   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure,
> Socket s4, Socket s6, Socket& socket, IPAddress& address,
> ConnectSocketState
> state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
>
> The problem is I can connect to the camera just fine with my IE browser,
> it's only inside the Winform App that I get this problem.
>
> I'm using Simon Fell's YATT trace program to help with the debuggin. When
> my
> IE browser is connecting to the webcam, YATT shows the HTTP traffic just
> fine.
>
> However, nothing shows up in YATT when I run the Winform App. That leads
> me
> to believe the program is being stopped short of actually sending any data
> to
> the webcam and throwing an error instead.
>
> Oh, I don't have any firewalls or virus programs running when I am running
> the program in the debugger, so they aren't getting in the way.
>
> I suspect it may be a permissions issue with the program, but I don't know
> how to begin to chase this down.  Does anyone have any suggestions or know
> of
> a solution?  Could this be an issue with the Express Editions?
>
> --
> Friends don't let friends use dialup.
Author
21 Jul 2006 5:46 PM
Ken Haynes
Sure! I get the exception thrown on the r.GetResponse() call below.

                            try
                            {
                                WebRequest r = WebRequest.Create(homePage);
                                r.PreAuthenticate = this.PreAuthenticate;
                                r.Credentials = c;
                                WebResponse s = r.GetResponse();
                                StreamReader sr = new
StreamReader(s.GetResponseStream());
                                char[] b = new char[5000];
                                sr.Read(b, 0, 5000);
                                sr.Close();
                                s.Close();
                            }
                            catch (Exception ex)
                            {

System.Diagnostics.Debug.WriteLine("=============: " + ex.Message);
                                throw;
                            }

--
Friends don''t let friends use dialup.


Show quote
"Kevin Spencer" wrote:

> Can you show us the code that employs the HttpWebRequest? Have you tried
> using it in any other way before?
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> Professional Chicken Salad Alchemist
>
> What You Seek Is What You Get.
>
>
> "Ken Haynes" <KenHay***@discussions.microsoft.com> wrote in message
> news:9C104029-4B74-4370-90E3-A86CF74CA0A7@microsoft.com...
> > I'm trying to get the motion detector sample code running from Scott
> > Hanselman's "Some Assembly Required" entry here:
> > http://msdn.microsoft.com/coding4fun/someassemblyrequired/babies/default.aspx.
> >
> > Very cool stuff, by the way.
> >
> > I'm using Visual C# 2005 Express Edition to build the application.
> >
> > When I build and run the application I get an error when I try to connect
> > to
> > my IP Webcam.  I can run it just fine, if I'm connected to a directly
> > connected USB webcam, but if I try and connect to an IP based webcam using
> > an
> > System.Net.HttpWebRequest call I have problems.
> >
> > I get a System.Net.WebException.
> > Inner exception message:
> > "No connection could be made because the target machine actively refused
> > it"
> > Inner exception native error code:
> > 10061
> >
> > The stack trace shows:
> >   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,
> > SocketAddress socketAddress)
> >   at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
> >   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure,
> > Socket s4, Socket s6, Socket& socket, IPAddress& address,
> > ConnectSocketState
> > state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
> >
> > The problem is I can connect to the camera just fine with my IE browser,
> > it's only inside the Winform App that I get this problem.
> >
> > I'm using Simon Fell's YATT trace program to help with the debuggin. When
> > my
> > IE browser is connecting to the webcam, YATT shows the HTTP traffic just
> > fine.
> >
> > However, nothing shows up in YATT when I run the Winform App. That leads
> > me
> > to believe the program is being stopped short of actually sending any data
> > to
> > the webcam and throwing an error instead.
> >
> > Oh, I don't have any firewalls or virus programs running when I am running
> > the program in the debugger, so they aren't getting in the way.
> >
> > I suspect it may be a permissions issue with the program, but I don't know
> > how to begin to chase this down.  Does anyone have any suggestions or know
> > of
> > a solution?  Could this be an issue with the Express Editions?
> >
> > --
> > Friends don't let friends use dialup.
>
>
>

AddThis Social Bookmark Button