no the service is installed on the server. It has run and currently runs great with no problems. What do you mean by coding horror? Also, the attached code is called by the timer. Here is the full function. private void StartTimerAndServerSocket() { Writ2ErrLog("Service Timer Initialized"); string sErr="Application is ready for processing"; try { Writ2ErrLog(sErr); m_tMonitor = new TD.Timer(new TD.TimerCallback(MonitorFunc),1, 0,45000);//45 sec if(m_sServerAddr==string.Empty) { m_sServerAddr=Dns.GetHostName(); } if(m_nPort==-1) { m_nPort=1024; } IPHostEntry hostEntry=Dns.Resolve(m_sServerAddr); IPAddress ipAddress = hostEntry.AddressList[0]; IPEndPoint ipEndPoint = new IPEndPoint(ipAddress,m_nPort); m_svSocket = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp); m_svSocket.Bind(ipEndPoint); m_svSocket.Listen(10); while(true) { Socket rtSocket=m_svSocket.Accept(); if(rtSocket.Connected) { TD.WaitCallback myCallBack = new TD.WaitCallback(ProcessClientRequest); TD.ThreadPool.QueueUserWorkItem(myCallBack,rtSocket); } } } catch(Exception ex) { m_svSocket.Close(); m_tMonitor.Dispose(); sErr="Start Error " + ex.Message; } finally { if(sErr!=string.Empty) { Debug.WriteLine(sErr); Writ2ErrLog(sErr); } }
Sameer