The nature of web applications
In the socket network programming prior to learning is based on:
- Architecture: C / S architecture
- Protocols: TCP / UDP protocol
- Running in the transport layer of the OSI model,
So in a web application is based on:
- Architecture: B / S architecture
- Protocol: Http protocol
- Application layer
When data needs to be transferred in binary form during transmission, conversion is performed before me: send (msg.encode ( 'utf8')) in the form of transmission, but this is not intuitive. For more intuitive, you should use bytes ( 'msg', encoding = 'utf8') and str (msg, encoding = 'utf8')
Then all web applications is essentially a socket server, and the user's browser is a client socket.
web communication principle:
- The browser sends a HTTP request;
- Server receives the request, generates an HTML document;
- HTML documents sent to the server to the browser as the appropriate body HTTP
- Browser receives corresponding HTTP, HTTP Body removed from the HTML document and display