Web Apps
A Web application is an application that can be accessed through the Web, and the greatest benefit is that the user has easy access to the application, and the user needs only a browser and no additional software to install. There are two modes of application: C/S,/b. c/S is a client/server-side program, which means that such programs generally run independently. and b/S is browser-side/server-side applications, such applications generally with the help of Google, Firefox and other browsers to run. Web applications are generally b/s mode. Web applications are first "applications", and programs written in standard programming languages, such as Java,python, are not inherently different. In the sense of network programming, the browser is a socket client, and the server is a socket service side.
1 ImportSocket2 3 defhandle_request (client):4 5Request_data = CLIENT.RECV (1024)6 Print("Request_data:", Request_data)7 8Client.send ("http/1.1 ok\r\nstatus:200\r\ncontent-type:text/html\r\n\r\n". Encode ("UTF8"))9Client.send ("". Encode ("UTF8"))Ten One defMain (): A -Sock =Socket.socket (socket.af_inet, socket. SOCK_STREAM) -Sock.bind (('localhost', 8812)) theSock.listen (5) - - whileTrue: - Print("The server is waiting for client-connection ....") +Connection, address =sock.accept () - handle_request (Connection) + connection.close () A at if __name__=='__main__': - -Main ()
Python's web App