问题依然存在,程序无法运行
错误提示:"socket.socket"无inet_aton属性
我现在的代码如下:
#! /usr/bin/env python
#
# Filename: PyHBClient.py
"""
PyHeartBeat client
It sends out an UDP packet every 30 seconds
Please adjust the constant parameters as needed
"""
from socket import socket, AF_INET, SOCK_DGRAM
from time import time, ctime, sleep
SERVERIP = '219.219.36.1'
HBPORT = 8002
BEATWAIT = 30
msg=socket.inet_aton('219.219.36.27')+'\x00\xe0\x4d\x00\x33\xe5'
print "yHeartBeat client sending to IP %s , port %d" % \
(SERVERIP, HBPORT)
print "\n*** Press Ctrl-C to stop ***\n"
while 1:
hbsocket = socket(AF_INET, SOCK_DGRAM)
hbsocket.sendto(msg, (SERVERIP, HBPORT))
if __debug__:
print "Time: %s" % ctime(time())
sleep(BEATWAIT) |