HTTP
HTTP, or Hypertext Transfer Protocol, is an application protocol that's implemented on top of the TCP/IP suite, and is what the World Wide Web (WWW) is built on. The HTTP protocol defines the request-response structure, in which a client (such as a web browser) requests a resource from a server whose address is given by a Uniform Resource Locator (URL), and the server responds with a resource, such as an HTML file. So instead of opening a TCP socket and keeping it open while passing raw TCP/IP packets, as in the preceding example, the HTTP client connects to the server over a TCP socket and sends an HTTP request packet, then the server sends back an HTTP response packet, and the socket is closed.
PyBBIO includes a library called BBIOServer
, which provides an API for creating simple HTML pages for web based user interfaces using HTTP. Let's run a simple example:
from bbio import * from bbio.libraries.BBIOServer import BBIOServer, Page server = BBIOServer(8000) def setup(): page1 =...