'TcpListener parser
I have a simple TcpListener and I want to parse the data it receives. Here is what I have and it works:
TcpListener listener = new TcpListener(localAddr, port);
var client = listener.AcceptTcpClient();
var buffer = new byte[10240];
var stream = client.GetStream();
var length = stream.Read(buffer, 0, buffer.Length);
var incomingMessage = Encoding.UTF8.GetString(buffer, 0, length);
results
Incoming message: POST /api/v1/myapi/ HTTP/1.1
Content-Type: application/json
ApiKey: dac38055e7914b1f8ca5de1683b58322
cache-control: no-cache
Postman-Token: 50da88e4-5c89-4368-a5eb-1574eb35b24a
User-Agent: PostmanRuntime/7.6.1
Accept: */*
Host: MyDNS:13000
accept-encoding: gzip, deflate
content-length: 590
Connection: keep-alive
AmazingDataFromBody
Is there anything that will parse this or do I have to write my own?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
