Python Programming/Sockets
Tools
General
Sister projects
In other projects
![]() | This page or section is an undeveloped draft or outline. You can help todevelop the work, or you can ask for assistance in theproject room. |
Make a very simple HTTP client
importsockets=socket.socket()s.connect(('localhost',80))s.send('GET / HTTP/1.1\nHost:localhost\n\n')s.recv(40000)# receive 40000 bytes
Connecting to and reading an NTP time server, returning the time as follows
ntpps picoseconds portion of timentps seconds portion of timentpms milliseconds portion of timentpt 64-bit ntp time, seconds in upper 32-bits, picoseconds in lower 32-bits