I am trying to write a TCP server application that I can use to test a tcp client. Receiving the connection works but the code to begin receive fails with the error below. All the examples that I found pass a byte array in just like this.
{"Unable to cast object of type 'System.Byte[]' to type 'System.Collections.Generic.IList`1[System.ArraySegment`1[System.Byte]]'."}
I think this is all you need to understand what I am doing. The error occurs on the BeginReceive method call.
{"Unable to cast object of type 'System.Byte[]' to type 'System.Collections.Generic.IList`1[System.ArraySegment`1[System.Byte]]'."}
I think this is all you need to understand what I am doing. The error occurs on the BeginReceive method call.
VB.NET:
Private _recvBuffer(1024) As Byte
Dim s As System.Net.Sockets.Socket = _connections(0)
.
.
s.BeginReceive(_recvBuffer, SocketFlags.None, New AsyncCallback(AddressOf EndRead), s)