把內(nèi)容過(guò)程中經(jīng)常用的一些內(nèi)容備份一次,下面內(nèi)容是關(guān)于python通過(guò)socket獲得點(diǎn)對(duì)點(diǎn)的信息的內(nèi)容。
創(chuàng)新互聯(lián)主要從事成都網(wǎng)站設(shè)計(jì)、網(wǎng)站制作、外貿(mào)營(yíng)銷(xiāo)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)朝陽(yáng)縣,十多年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專(zhuān)業(yè),歡迎來(lái)電咨詢(xún)建站服務(wù):13518219792
import socket
print "Creating socket...",
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print "done."
print "Looking up port number...",
port = socket.getservbyname('http', 'tcp')
print "done."
print "Connecting to remote host on port %d..." % port,
print "done."
print "Connected from", s.getsockname()
print "Connected to", s.getpeername()
返回結(jié)果如下:
Creating socket... done.
Looking up port number... done.
Connecting to remote host on port 80... done.
Connected from ('127.0.0.1', 51475)
Connected to ('116.255.236.107', 80)
分享標(biāo)題:python通過(guò)socket獲得點(diǎn)對(duì)點(diǎn)的信息的代碼
當(dāng)前URL:http://www.rwnh.cn/article28/igpccp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站建設(shè)、網(wǎng)站策劃、虛擬主機(jī)、微信小程序、網(wǎng)站制作、網(wǎng)站內(nèi)鏈
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)