Hi,
below is my code, but when i send the message thru client socket i receive Specified argument was out of the range of valid values. Parameter name: size

Can anyone help me !

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim serverStream As NetworkStream = clientSocket.GetStream()
        Dim outStream As Byte() = _
        System.Text.Encoding.ASCII.GetBytes("0800822000000000000004000000000000000920092126012345001")

        serverStream.Write(outStream, 0, outStream.Length)
        serverStream.Flush()

        Dim inStream(1024) As Byte
        serverStream.Read(inStream, 0, CInt(clientSocket.ReceiveBufferSize))
        Dim returndata As String = _
        System.Text.Encoding.ASCII.GetString(inStream)
        msg("Data from Server : " + returndata)
    End Sub

This will fix it.

Dim inStream(clientSocket.ReceiveBufferSize) As Byte
serverStream.Read(inStream, 0, clientSocket.ReceiveBufferSize)
Dim returndata As String = System.Text.Encoding.ASCII.GetString(inStream)
commented: tq +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.