欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

python使用socket進行簡單網(wǎng)絡(luò)連接的方法

 更新時間:2015年04月29日 14:34:44   作者:重負在身  
這篇文章主要介紹了python使用socket進行簡單網(wǎng)絡(luò)連接的方法,實例分析了Python使用socket的基本技巧,非常具有實用價值,需要的朋友可以參考下

本文實例講述了python使用socket進行簡單網(wǎng)絡(luò)連接的方法。分享給大家供大家參考。具體如下:

import socket
print "Creating socket...",
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print "done."
print "Connecting to www.dbjr.com.cn",
s.connect(("www.dbjr.com.cn", 80))
print "done."

上面的代碼返回下面的結(jié)果:

Creating socket... done.
Connecting to www.dbjr.com.cn done.

希望本文所述對大家的Python程序設(shè)計有所幫助。

相關(guān)文章

最新評論