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. Visual Basic
  4. networkStream.BeginRead() / Threading doubt

networkStream.BeginRead() / Threading doubt

Scheduled Pinned Locked Moved Visual Basic
question
2 Posts 1 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.
  • C Offline
    C Offline
    carlos_rocha
    wrote on last edited by
    #1

    Hi! I use the beginread() method to read data asynchrounously from a networkStream.In the documentation says that the callback method will run in another thread, and so it happens.The thing is that after the callback function ends (if i do another beginRead() or not) the thread doesn't terminate, it just stays there and if there is another async. read the same thread will respond.(different networkstreams with different threads). Shouldn't the thread terminate?If not how do i end it. When i use delegates and beginInvoke() for each call the respective thread terminates and another different thread will run the callback function, after a new beginInvoke...but when i do this with beginRead and EndRead it doesn't happen. Is this correct or am i doing anything wrong? Thanks in advance. Never say never

    C 1 Reply Last reply
    0
    • C carlos_rocha

      Hi! I use the beginread() method to read data asynchrounously from a networkStream.In the documentation says that the callback method will run in another thread, and so it happens.The thing is that after the callback function ends (if i do another beginRead() or not) the thread doesn't terminate, it just stays there and if there is another async. read the same thread will respond.(different networkstreams with different threads). Shouldn't the thread terminate?If not how do i end it. When i use delegates and beginInvoke() for each call the respective thread terminates and another different thread will run the callback function, after a new beginInvoke...but when i do this with beginRead and EndRead it doesn't happen. Is this correct or am i doing anything wrong? Thanks in advance. Never say never

      C Offline
      C Offline
      carlos_rocha
      wrote on last edited by
      #2

      Hi! Oops.After all the thread also stays there in the list but the threadpool says that there is no socket taken...shouldn't the thread leave the thread list (in the VStudio thread list) after it terminates? Never say never

      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