Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Python Programming/Networks

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Internet Databases Sockets Python can also communicate via sockets. Connecting to a server This simple Python program will fetch a 4096 byte HTTP response from Google: import socket, sys sock = socket.socket ( socket.AF_INET, socket.SOCK_STREAM ) sock.connect ( ( "google.com", 80 ) ) sock.send('GET / HTTP/1.1\r\n') sock.send('User-agent: Mozilla/5.0 (wikibooks test)\r\n\r\n') print(sock.recv(4096)) High-level interfaces Most Python developers will prefer to use a high-level interface over using sockets, such as Twisted and urllib2. Internet Databases