hi guys
I can use "Get or Post" method with simple socket connection. I can send any parameters via url to "Get or Post" method. But i cant use [formBody] property.
What is wrong?
var xSocket = new System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp); var xEndPoint = new System.Net.IPEndPoint(System.Net.Dns.GetHostEntry("127.0.0.1").AddressList[0], 80); xSocket.Connect(xEndPoint); xSocket.SetSocketOption(System.Net.Sockets.SocketOptionLevel.Tcp, System.Net.Sockets.SocketOptionName.NoDelay, true); xSocket.SendTimeout = 1000; //byte[] xContent = System.Text.Encoding.UTF8.GetBytes("this is content"); string xRequestLine = "Get /api/My/45 HTTP/1.1\r\n"; string xHeaderLines = "Host: localhost" + "\r\n" + "Accept: text/json; charset=utf-8" + "\r\n" + "Accept-Encoding: gzip, deflate" + "\r\n" + //"Content-Type: application/json" + "\r\n" + //"Transfer-Encoding: chunked" + "\r\n" + "Connection: Close" + "\r\n" + //"Content-Length: " + xContent.Length.ToString() + "\r\n" + "\r\n"; // EmptyLine xSocket.Send(System.Text.Encoding.UTF8.GetBytes(xRequestLine)); xSocket.Send(System.Text.Encoding.UTF8.GetBytes(xHeaderLines)); //xSocket.Send(xContent);