Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. window service

window service

Scheduled Pinned Locked Moved C#
question
8 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yogesh_softworld123
    wrote on last edited by
    #1

    i want to create one window service for watching a file. whenever file content change i want to get new data, which is just comes to file. how can i do this. there is any way to do this??

    yogesh

    P 1 Reply Last reply
    0
    • Y yogesh_softworld123

      i want to create one window service for watching a file. whenever file content change i want to get new data, which is just comes to file. how can i do this. there is any way to do this??

      yogesh

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      Need more information. Is it a text file to which additional data is added at the end, like a log file? I've written a Windows Service to do that.

      Y P 2 Replies Last reply
      0
      • P PIEBALDconsult

        Need more information. Is it a text file to which additional data is added at the end, like a log file? I've written a Windows Service to do that.

        Y Offline
        Y Offline
        yogesh_softworld123
        wrote on last edited by
        #3

        yes that is a text file. whenever new data comes to file, i want to perform some action through window service. please help me sir,

        yogesh

        P 1 Reply Last reply
        0
        • Y yogesh_softworld123

          yes that is a text file. whenever new data comes to file, i want to perform some action through window service. please help me sir,

          yogesh

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #4

          I had the service running on a thirty* second cycle; on each cycle it would: 0) Open the file 1) Seek to the position where it had read to on the last read 2) Read to the end of the file 3) Close the file 4) Store the new position There were a number of other challenges to overcome, including being sure that it read only complete lines. Your requirements may vary. * Configurable.

          Y 1 Reply Last reply
          0
          • P PIEBALDconsult

            I had the service running on a thirty* second cycle; on each cycle it would: 0) Open the file 1) Seek to the position where it had read to on the last read 2) Read to the end of the file 3) Close the file 4) Store the new position There were a number of other challenges to overcome, including being sure that it read only complete lines. Your requirements may vary. * Configurable.

            Y Offline
            Y Offline
            yogesh_softworld123
            wrote on last edited by
            #5

            could u give me code for that????

            yogesh

            P 1 Reply Last reply
            0
            • Y yogesh_softworld123

              could u give me code for that????

              yogesh

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #6

              It wouldn't be much use to you; it's very specific to one situation. But with what I've said so far and an article on writing a Windows Service you should have a working version by the end of the week.

              1 Reply Last reply
              0
              • P PIEBALDconsult

                Need more information. Is it a text file to which additional data is added at the end, like a log file? I've written a Windows Service to do that.

                P Offline
                P Offline
                Patrik M J
                wrote on last edited by
                #7

                Create a Windows service and use the FileSystemWatcher class. You will get an event every time your file has been changed. Patrik

                P 1 Reply Last reply
                0
                • P Patrik M J

                  Create a Windows service and use the FileSystemWatcher class. You will get an event every time your file has been changed. Patrik

                  P Offline
                  P Offline
                  PIEBALDconsult
                  wrote on last edited by
                  #8

                  That might be suitable for the OP's requirements, but not mine.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups