2

I request to read my problem till end. Someone might find it duplicate.

I have a windows application (Client App) a machine & Web Application (Server App) on another machine in same Network. Client app is capturing screen 5fps and keeping in a local folder which is shared. I have a Windows service which runs on server machine. It moves client images to server directory from client shared folder. I am using File.Move to move the files along with FastDirectoryEnumerator class. These moved files are used to create videos later and also used to show live streaming.

Questions:

Is there any other (Best/Fastest) option to move these files in real time (transfer as soon as it is created at client side)? I am also interested in file transfer in real time without shared folder.

Update:

My major concerns.

  1. File Transfer should be faster to allow live streaming through my server app (ASP.Net)

  2. Client should retain it if server/connection is not available & transfer as soon as it comes online.

Sandeep Gupta
  • 127
  • 1
  • 12
  • 4
    You could create a TCP Client and Server to send the image data directly to your remote server. So the time to write the screenshots to your own disk would be eliminated. – cansik Mar 30 '15 at 13:06
  • You may want to consider compressing the files to speed up transfer. [Here](http://stackoverflow.com/questions/26224095/how-to-find-the-difference-between-two-images/26225153?s=1|1.5442#26225153) is a difference method that might help, if transfer speed is the issue. – TaW Mar 30 '15 at 13:33
  • 1
    I am writing the files locally because I want to keep the files locally if server is not available for transfer. Then I will also have to keep eye on server connection availability and start file transfer next moment server comes online. Do you have any optimized way to check availability? I cannot compress the images as I want to show as live streaming as server as another feature of my app. – Sandeep Gupta Mar 30 '15 at 14:30

3 Answers3

1

I do not know why you have the server monitoring the client's share, surely this monitoring or as you say, DirectoryEnumerator procedure takes time.

Since the client knows when the image has been captured why don't you send this information to the server immediately from the client? In this way you do not need to monitor clients from server, you do not need to find / enumerate folders, you simply transfer data from client to server as soon as it is available with a specific WCF / Web Service call which takes a stream of bytes as input.

Davide Piras
  • 43,984
  • 10
  • 98
  • 147
0

If you have no control over the client app creating the image files you could have a FileSystemWatcher running on the client machine. Add an event handler which will be called whenever the Created event is raised due to a file being created on the file system.

See https://stackoverflow.com/a/15018082/1730317

Community
  • 1
  • 1
embee
  • 1,007
  • 7
  • 15
0

Things to consider in gaining the best performance out of this type of activity.

  • For "Real Time" notifications you may want to look at the FileSystemWatcher class. See the documentation for a complete example. Word of warning on this though, when the Operating system is busy it will drop some of these events and you will not be informed of the new file. It's a good idea to program a sweep up loop make doubly sure you have all the files, I have been caught out with this in the past.

  • You may want to check your hardware configuration, like network latency between the pc and server, and also the disk speeds at both the PC and Server. A low spec SSD is likely to have a big performance benefit in these kinds of operations over spinning disks.

BMac
  • 2,183
  • 3
  • 22
  • 30