How to get a text message from a captured packet?

I made a program that sends / receives messages from the same program that is a server. Used classes TcpClient and NetworkStream. I send messages in this way and everything works.

byte[] messagebuffer = Encoding.ASCII.GetBytes(txtMessage.Text);
stream.Write(messagebuffer, 0, messagebuffer.Length);

Made examples from the Internet sniffer, which intercepts packets from the specified IP.

socket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);
socket.Bind(new IPEndPoint(IPAddress.Parse(comboBox1.SelectedItem.ToString()), int.Parse(tbPort.Text)));
socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.HeaderIncluded, true);

byte[] byInc = new byte[] { 1, 0, 0, 0 };
byte[] byOut = new byte[4];
buffer = new byte[4096];
socket.IOControl(IOControlCode.ReceiveAll, byInc, byOut);
socket.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, OnReceive, null);

I receive the intercepted data buffer and upload it to the ready class from the Internet: https://pastebin.com/qCQ5eWiS

I send a message from the client / server: "test" and intercept the package with a sniffer. I am trying to display the data, but the gibberish is displayed. What is the problem?