| | |
windows service for receiving files thru sockets
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
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-
any help would be highly appreciated
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-
C# Syntax (Toggle Plain Text)
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() { try { // 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); Process.Start(fs.Name); } catch (Exception e) { //Console.WriteLine(e.ToString ()); } finally { fs.Close(); } } protected override void OnStart(string[] args) { ReceiveFile(); }
any help would be highly appreciated
Last edited by ujwaliyer; Jan 16th, 2008 at 2:07 am.
![]() |
Similar Threads
- memory management in wndows 2000 (Windows NT / 2000 / XP)
- Hotmail Login (Windows NT / 2000 / XP)
Other Threads in the C# Forum
- Previous Thread: stopping a object sender event, under certain conditions
- Next Thread: C# Express breakpoint list?
| Thread Tools | Search this Thread |
.net access ado.net algorithm array barchart bitmap box broadcast buttons c# cast check checkbox client color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel file files form format forms function gdi+ httpwebrequest image index input install java label list listbox listener mailmerge mandelbrot math mouseclick mysql operator path photoshop picturebox pixelinversion post programming radians regex remote remoting richtextbox robot save saving serialization server sleep socket sockets sql sql-server statistics stream string stringformatting sun table tcp text textbox thread time timer update usercontrol validation view visualstudio webbrowser windows winforms wpf xml






