<filename>tmp/real_time_log_analy/resu/send_packet.py<gh_stars>1-10
#!/usr/bin/env python

import os
import sys
import socket
import struct

pps_ip = "10.0.110.82"
pps_port = 7545

def udp_send_message(ip, port, arr):
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    #for data in arr:
    s.sendto(arr, (ip, port))
    s.close()
        


data = struct.pack(
    '=HHHH200s',
    80, #id
    1, #type
    200 + 8, #length
    len('www.ifeng.com'), #domain_len
    'www.ifeng.com' #domain
)
#print "data send to pps len: ", len(data)
udp_send_message(pps_ip, pps_port, data)

<filename>tmp/real_time_log_analy/resu/send_packet.py<gh_stars>1-10
#!/usr/bin/env python

import os
import sys
import socket
import struct

pps_ip = "10.0.110.82"
pps_port = 7545

def udp_send_message(ip, port, arr):
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    #for data in arr:
    s.sendto(arr, (ip, port))
    s.close()
        


data = struct.pack(
    '=HHHH200s',
    80, #id
    1, #type
    200 + 8, #length
    len('www.ifeng.com'), #domain_len
    'www.ifeng.com' #domain
)
#print "data send to pps len: ", len(data)
udp_send_message(pps_ip, pps_port, data)

#!/usr/bin/env python #for data in arr: #id #type #length #domain_len #domain #print "data send to pps len: ", len(data)