1. 程式人生 > >python:使用udp協議傳送飛秋訊息

python:使用udp協議傳送飛秋訊息

#coding:utf-8

import socket
for i in range(200):
	sock =socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
	host = '192.168.0.102'
	port = 2425
	#print 'this is socket_client'
	sock.connect(('192.168.0.102',2425))
	context = '1_lbt4_10#32899#002481627512#0#0#0:1289671407:Administrator:MICROSO-697TGLD:288:hello. '
	sock.send(context)
	#print sock.recvfrom(512)
	#sock.close()