Hi everyone, I wrote c client socket program in Linux and c# server program in window. I want to send text from client to server. I can send from c client program by using write() function. But I don't know how to receive in my c# server side. Should I use networkstream? I used networkstream.read but cannot receive it. So if anyone knows a way to get it, pls kindly guide me. Thanks.

my server code is
NetworkStream ns;
private void DataReceived()
     int bytesRead = 0;
     byte[] length = new byte[4];
     if(length == null)
        bytesRead =  ns.Read(length, 0 , 4);
        string str = System.Convert.ToString(bytesRead);
        this.Invoke(new MethodInvoker(delegate {textBox2.Text = str; }));

Is it something wrong in my code? If anyone knows, pls kindly guide me. Thanks.