Basic Connection Example : Web Client « Network « Python






Basic Connection Example

Basic Connection Example
import socket

print "Creating socket...",
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print "done."

print "Connecting to www.java2s.com.",
s.connect(("www.java2s.com", 80))
print "done."

           
       








Related examples in the same category

1.Obtain Web Page
2.Obtain Web Page With Full Error Handling
3.Obtain Web Page Information With Simple Error Handling
4.Obtain Web Page Information With Error Document Handling
5.Submit GET Data