< Python Programming
HTTP Client
Make a very simple HTTP client
import socket
s = socket.socket()
s.connect(('localhost', 80))
s.send('GET / HTTP/1.1\nHost:localhost\n\n')
s.recv(40000) # receive 40000 bytes
NTP/Sockets
Connecting to and reading an NTP time server, returning the time as follows
ntpps picoseconds portion of time ntps seconds portion of time ntpms milliseconds portion of time ntpt 64-bit ntp time, seconds in upper 32-bits, picoseconds in lower 32-bits
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.