使用PYTHON发送多播数据

发表于:2007-07-04来源:作者:点击数: 标签:

我已经编制好了一个PYTHON脚本,能够在LINUX上发送多播数据。其实编制起来也不算太麻烦。具体代码如下:

#!/usr/bin/env python

from socket import *
from time import sleep,time,ctime

HOST = '229.0.0.15'
PORT = 9999
BUFSIZ = 1024
ADDR = (HOST, PORT)

udpCliSock = socket(AF_INET, SOCK_DGRAM)

data = 't'*200
count = 0
while(count<100 ):
 udpCliSock.sendto(data, ADDR)
 sleep(1)
 count = count+1

udpCliSock.close()

原文转自:http://www.ltesting.net