VB.Net Sending byte array from client to server
        Posted  
        
            by k80sg
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by k80sg
        
        
        
        Published on 2010-06-15T08:22:44Z
        Indexed on 
            2010/06/15
            9:42 UTC
        
        
        Read the original article
        Hit count: 364
        
Hi guys, I am new to VB.net and struggling to get out of VB6's way of sending data, I am doing this to send a byte array from my client to server, please advice if this is the right way, thanks:
The sending portion:
 Private Sub Button1_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles Button1.Click
        Dim arrNo(3) As Integer
        arrNo(0) = 1400
        arrNo(1) = 1000
        arrNo(2) = 1200
        arrNo(3) = 1350
        Dim i As Integer
        For i = 0 To arrNo.Length - 1
            Dim outStream() As Byte = BitConverter.GetBytes(arrNo(i))
            Debug.Print(arrNo(i))
            serverStream.Write(outStream, 0, outStream.Length)
            serverStream.Flush()
        Next
    End Sub
© Stack Overflow or respective owner