hello everyone,

I have created a console app for receiving files thru sockets.

Now what i need to do is to change it to a windows service so that it will dynamically keep receiving files all the times -- and store them in a separate folder.

The problem is that-

1) am not able to install the service , an exception gets raised. As a result "the windows marks my service for deletion."

here is the code-

private static int localPort = 6000 ;
	private static UdpClient receivingUdpClient = new UdpClient(localPort);
	private static IPEndPoint RemoteIpEndPoint = null ;
	private static FileStream fs;
	private static byte[] receiveBytes = new byte[0]; 
	public static void ReceiveFile()

	// Receive file
	receiveBytes = receivingUdpClient.Receive(ref RemoteIpEndPoint);	i++;
	fs = new FileStream(@"E:\recd files\temp"+i+"."+"txt", FileMode.Create,
	FileAccess.ReadWrite, FileShare.ReadWrite);
	fs.Write(receiveBytes, 0, receiveBytes.Length);
			catch (Exception e)
				//Console.WriteLine(e.ToString ());
protected override void OnStart(string[] args)

any help would be highly appreciated

>am not able to install the service , an exception gets raised
What exception?

hi narue,
thanks for taking time for my problem
it says that the operation "did not complete in a timely fashion"

furthurmore- the windows marks my service for "deletion".
so i am not able to use it anymore...

This article has been dead for over six months. Start a new discussion instead.