Web Camera Server

The web camera server is a program written in C# to be a Windows service. When started the program polls the operating system for camera devices and will exit if none are found, if a camera is found however it will then start taking pictures and make them available for transmission to a remote process.

This program was modified from the program C# WebCam Service with FTP and Installer available at CodeProject and written by Dan Glass. The original program took the pictures that were captured and sent them to a user designated FTP site; this part was changed so that the image was sent over a socket using the process described in the Thesis document. The functionality that logged images was removed due to constant errors and a lack of desire or time to debug this portion of code.

The options for this program are set in the app.config file. The entire file follows.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
   <appSettings>
         <add key="path" value=".\WebCam.jpg"/>
         <add key="CaptureCycleSeconds" value="2"/>
         <add key="KeepOldImageCount" value="200"/>
         <add key="port" value="51515"/>
   </appSettings>
</configuration>

The options available are self-explanatory for the most part. The 'CaptureCycleSeconds' key name however is a hold-over from the original program. A cycle is now 200 milliseconds not 1 second, this key indicates how many periods of 200 ms to sleep between taking pictures and sending them on.

The program writes multiple error logs to c:\WebCam?.log, so if problems are encountered check here for relevant information.

The full Visual Studio 2003 solution and source code with both Debug and Release compiled binaries is available here (213KB).

Written by: Nathan Diederich
©2005