nemesys777
May 21st, 2002, 04:20 PM
Hi,
I'm trying to recieve a packet of data from a client application and store the bytes of that packet into a byte array. There are 62 bytes of data in the packet. . This is what I have so far..
Public Sub Listen()
Dim SocketStream As NetworkStream
Dim connection as socket
Dim reader as binaryreader
Dim listener As New TcpListener(5000)
listener.Start()
TextBox1.Text &= vbCrLf & "Awaiting Connections.."
connection = listener.AcceptSocket()
SocketStream = New NetworkStream(connection)
reader = New BinaryReader(SocketStream)
Dim bytearray As New BitArray(62) 'PROBLEM LINE #1
bytearray = reader.ReadBytes(62) 'PROBLEM LINE #2
End Sub
I want to read the first packet from the client and store it in a byte array:
bytearray = reader.ReadBytes(62) ????
I might not be declaring byte array correctly. My error comes up on the line
bytearray = reader.ReadBytes(62)
It says ": Value of type '1-dimensional array of Byte' cannot be converted to 'System.Collections.BitArray'."
Any help on this would be great. Thanks in Advance.
I'm trying to recieve a packet of data from a client application and store the bytes of that packet into a byte array. There are 62 bytes of data in the packet. . This is what I have so far..
Public Sub Listen()
Dim SocketStream As NetworkStream
Dim connection as socket
Dim reader as binaryreader
Dim listener As New TcpListener(5000)
listener.Start()
TextBox1.Text &= vbCrLf & "Awaiting Connections.."
connection = listener.AcceptSocket()
SocketStream = New NetworkStream(connection)
reader = New BinaryReader(SocketStream)
Dim bytearray As New BitArray(62) 'PROBLEM LINE #1
bytearray = reader.ReadBytes(62) 'PROBLEM LINE #2
End Sub
I want to read the first packet from the client and store it in a byte array:
bytearray = reader.ReadBytes(62) ????
I might not be declaring byte array correctly. My error comes up on the line
bytearray = reader.ReadBytes(62)
It says ": Value of type '1-dimensional array of Byte' cannot be converted to 'System.Collections.BitArray'."
Any help on this would be great. Thanks in Advance.