如何取得SOCKET当前监控所得到的数据的BYTE长度

解决方案 »

  1.   

    用ReceiveBufferSize属性
     
    IPAddress ipAddress = IPAddress.Parse("127.0.0.1");
                TcpListener tcpListener = new TcpListener(ipAddress,500);
                tcpListener.Start();
    while(true)
    {
        TcpClient _tcpClient=tcpListener.AcceptTcpClient();
        byte[] receiver=new byte[_tcpClient.ReceiveBufferSize];
    }QQ群:59557329 .NET技术开发联盟
    希望大家可以踊跃参加,积极讨论
      

  2.   

                 int lenth;
                byte[] datas = new byte[1024];
                String s="";
                 isRun = true;
                 ns = client.GetStream();
                lenth = ns.Read( datas ,0,1024);lenth就是实际获得的数据长度
      

  3.   

    还是不行,有没有一个可以代替vb6中的Winsock1.BytesReceived的