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. Aynchronous approach on event

Aynchronous approach on event

Scheduled Pinned Locked Moved C#
visual-studiocomsysadminhelp
6 Posts 4 Posters 0 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.
  • D Offline
    D Offline
    dabuskol
    wrote on last edited by
    #1

    Hi, Really need help and guidance. I need to pull data from server if there is available data, it shouldn't interrupt users action while data is being pulled. Scenario: Login to connect Pull data if available once complete, process wait for the next data.. I tried different approach but failed. New to asynchronous 1. The link below is working but failed and timeout expired in the middle. https://msdn.microsoft.com/en-us/library/bew39x2a(v=vs.110).aspx[^] It's eating all my time. :confused: Really Appreciate

    Dabsukol

    P A R D 4 Replies Last reply
    0
    • D dabuskol

      Hi, Really need help and guidance. I need to pull data from server if there is available data, it shouldn't interrupt users action while data is being pulled. Scenario: Login to connect Pull data if available once complete, process wait for the next data.. I tried different approach but failed. New to asynchronous 1. The link below is working but failed and timeout expired in the middle. https://msdn.microsoft.com/en-us/library/bew39x2a(v=vs.110).aspx[^] It's eating all my time. :confused: Really Appreciate

      Dabsukol

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      This sounds like an ideal job for Rx. If I were you, that's the avenue I would explore.

      1 Reply Last reply
      0
      • D dabuskol

        Hi, Really need help and guidance. I need to pull data from server if there is available data, it shouldn't interrupt users action while data is being pulled. Scenario: Login to connect Pull data if available once complete, process wait for the next data.. I tried different approach but failed. New to asynchronous 1. The link below is working but failed and timeout expired in the middle. https://msdn.microsoft.com/en-us/library/bew39x2a(v=vs.110).aspx[^] It's eating all my time. :confused: Really Appreciate

        Dabsukol

        A Offline
        A Offline
        Afzaal Ahmad Zeeshan
        wrote on last edited by
        #3

        A very simple one would be to create a task and run it,

        Task.Run(async () =>
        {
        // Your code to load the content with awaits
        // To put it on a separate thread
        });

        Otherwise, you can always consider using asynchronous programming model[^]. In which you create methods, functions with async modifiers and then use the awaits to continue processing until the work (job, whatever) has been done.

        public async void getData(){
        // Assume Task GetDataAsync() { gets the data from server }
        app.IntVariable = await server.GetDataAsync(); // await would fetch the int value
        }

        Also, since the error is Time out I would suggest that you configure your server also. There may be a problem with that, Timeout would occur regardless of async or sync programming being used.

        The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

        1 Reply Last reply
        0
        • D dabuskol

          Hi, Really need help and guidance. I need to pull data from server if there is available data, it shouldn't interrupt users action while data is being pulled. Scenario: Login to connect Pull data if available once complete, process wait for the next data.. I tried different approach but failed. New to asynchronous 1. The link below is working but failed and timeout expired in the middle. https://msdn.microsoft.com/en-us/library/bew39x2a(v=vs.110).aspx[^] It's eating all my time. :confused: Really Appreciate

          Dabsukol

          R Offline
          R Offline
          Ravi Bhavnani
          wrote on last edited by
          #4

          dabuskol wrote:

          it shouldn't interrupt users action while data is being pulled.

          What kind of app is it?  WinForms, WPF, web, mobile? /ravi

          My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

          D 1 Reply Last reply
          0
          • R Ravi Bhavnani

            dabuskol wrote:

            it shouldn't interrupt users action while data is being pulled.

            What kind of app is it?  WinForms, WPF, web, mobile? /ravi

            My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

            D Offline
            D Offline
            dabuskol
            wrote on last edited by
            #5

            It is a window service. It will run in the background and pull data from the server then save to the databse. My Client program will read the updated value from DB

            Dabsukol

            1 Reply Last reply
            0
            • D dabuskol

              Hi, Really need help and guidance. I need to pull data from server if there is available data, it shouldn't interrupt users action while data is being pulled. Scenario: Login to connect Pull data if available once complete, process wait for the next data.. I tried different approach but failed. New to asynchronous 1. The link below is working but failed and timeout expired in the middle. https://msdn.microsoft.com/en-us/library/bew39x2a(v=vs.110).aspx[^] It's eating all my time. :confused: Really Appreciate

              Dabsukol

              D Offline
              D Offline
              dabuskol
              wrote on last edited by
              #6

              Thanks for the help. Project works fine. Please see link below which serves as my guidance. http://www.devarticles.com/c/a/C-Sharp/Socket-Programming-in-C-sharp-Part-II/1/[^]

              Dabsukol

              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