Results 1 to 38 of 38

Thread: Receive Paremeters on Multithreaded Server

Threaded View

  1. #33

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2006
    Location
    Florida, USA
    Posts
    565

    Re: Receive Paremeters on Multithreaded Server

    Also, it looks like this stream loop is not active all the time. Should this loop be running the entire time that it is connected? Or should this close at some point? Is this a good way to do it?


    vb Code:
    1. ''' <summary>
    2.     ''' Watches a stream while a user is connected? Stays alive while user is connected?
    3.     ''' </summary>
    4.     Private Sub streamWatcher(ByVal objStream As Object)
    5.         Try
    6.             Dim curStream As NetworkStream = CType(objStream, NetworkStream)
    7.             Do Until Disposing = True Or curStream Is Nothing  
    8.  
    9.                 If curStream.DataAvailable Then
    10.                     Dim message As String = receiveText(curStream)
    11.                     RaiseEvent DataArrival(Me, message)
    12.                 End If
    13.                 Threading.Thread.Sleep(10)
    14.  
    15.             Loop
    16.         Catch
    17.         End Try
    18.     End Sub
    Last edited by rex64; Nov 24th, 2012 at 12:10 PM.
    I use VB .NET 2022. Currently developing StudyX educational software, PlazSales POS system and Yargis a space ship shooter game.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width