12-12-2024, 07:34 AM
Don't need to modify TcpSocket class. It's a low-level class, because TCP is a low-level protocol. Use it's functions to create higher-level code, for example a HTTP server.
Don't need GET. When client.Receive receives the first data, it probably contains all HTTP headers, including Content-Length (example below). If possibly there is more data to read, it probably returns 1. But it does not know how much data the client will send. It can return 1 even if there is no more data. The caller must somehow determine whether need to read again (and again...). For it can be used Content-Length. This should work in simple cases.
Don't need GET. When client.Receive receives the first data, it probably contains all HTTP headers, including Content-Length (example below). If possibly there is more data to read, it probably returns 1. But it does not know how much data the client will send. It can return 1 even if there is no more data. The caller must somehow determine whether need to read again (and again...). For it can be used Content-Length. This should work in simple cases.
Quote:POST /saveFile HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT; Windows NT 10.0; lt-LT) WindowsPowerShell/5.1.26100.2161
Content-Type: multipart/form-data
Host: 127.0.0.1:5033
Content-Length: 18749
Expect: 100-continue
Connection: Keep-Alive
Data here. Possibly only part of data the first time.
