Results 1 to 3 of 3

Thread: How to send data using a stream

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    Wisconsin
    Posts
    788

    Resolved How to send data using a stream

    I want to send data from the server to the client using sockets. How can I do that? Once I get the data into a dataset I would like to return the dataset to the client program using a NetworkStream. Here is the code I have so far.
    Code:
        Public Sub listenerThread()
            Dim tcpListener As New TcpListener(8080)
            Dim handlerSocket As Socket
            Dim thdstHandler As ThreadStart
            Dim thdHandler As Thread
            tcpListener.Start()
            Do
                handlerSocket = tcpListener.AcceptSocket
                If handlerSocket.Connected Then
                    SyncLock (Me)
                        alSockets.Add(handlerSocket)
                    End SyncLock
                    thdstHandler = New ThreadStart(AddressOf handlerThread)
                    thdHandler = New Thread(thdstHandler)
                    thdHandler.Start()
                End If
            Loop
        End Sub
        Public Sub handlerThread()
            Dim handlerSocket As Socket
            handlerSocket = alSockets(alSockets.Count - 1)
            Dim networkStream As NetworkStream = New NetworkStream(handlerSocket)
            Dim blockSize As Int16 = 1024
            Dim thisRead As Int16
            Dim dataByte(blockSize) As Byte
            Dim da As New DataAccess
            SyncLock Me
                Dim filestream As Stream
                filestream = da.GetData("SELECT * FROM CKMF01")
       ''is this where the data is sent back???
             ''filestream = File.OpenWrite("C:\upload.txt")
                While True
    
                End While
            End SyncLock
        End Sub

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to send data using a stream

    I see the checkmark.

    Is this resolved?

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    Wisconsin
    Posts
    788

    Re: How to send data using a stream

    Not yet. Not sure what you mean by check mark?

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