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?

Signature
Friends don't let friends use dialup.
Kevin Spencer - 21 Jul 2006 11:14 GMT
Can you show us the code that employs the HttpWebRequest? Have you tried
using it in any other way before?

Signature
HTH,
Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist
What You Seek Is What You Get.
> I'm trying to get the motion detector sample code running from Scott
> Hanselman's "Some Assembly Required" entry here:
[quoted text clipped - 48 lines]
> of
> a solution? Could this be an issue with the Express Editions?
Ken Haynes - 21 Jul 2006 18:46 GMT
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;
}

Signature
Friends don''t let friends use dialup.
> Can you show us the code that employs the HttpWebRequest? Have you tried
> using it in any other way before?
[quoted text clipped - 51 lines]
> > of
> > a solution? Could this be an issue with the Express Editions?