April 2026
Intermediate
631 pages
16h 20m
English
Now, let’s learn how to write out a response to a request from a client. The response from the server to a connection request from a client must be a certain format. Let’s first look at the syntax and then dive into how to make a valid response and how to return different responses.
Listing 16.6 shows the syntax of a response.
HTTP-Version Status-Code Reason-Phrase CRLFheaders CRLFmessage-bodyex: HTTP/1.1 200 OK\r\n\r\n
Listing 16.6 Response Syntax
First, we have the status line, which consists of the HTTP version, the status code, the reason phrase, and a carriage return line feed sequence. The status codes indicate whether a specific HTTP request has been successfully completed or not. ...
Read now
Unlock full access