w*s 发帖数: 7227 | 1 hi, i'm new to this, many thanks for help !
trying to send a query packet out,
size 1454 bytes, 1st word 0xfffffffb, 2nd 0xffffffff, 3rd 0x392
the correct packet sent from c code is captured in wireshark in the picture,
but got this,
socket.error: [Errno 10051] A socket operation was attempted to an
unreachable network
The code is like this,
def send_pnp_query():
print "... send query ..."
msg = bytearray(1454)
#ptr = PNP(msg)
msg[0] = 0xfb
msg[1] = 0xff
msg[2] = 0xff
msg[3] = 0xff
msg[4] = 0xff
msg[5] = 0xff
msg[6] = 0xff
msg[7] = 0xff
msg[8] = 0x92
msg[9] = 0x03
msg[10] = 0x00
msg[11] = 0x00
#ptr.data['lDstAddress'] = "ffffffff"
#ptr.data['lMsgType'] = 914
t = buffer(msg, 0)
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('192.168.2.3', 2001)) # not sure about this
s.send(t)
print "... query sent ..." | j*a 发帖数: 14423 | 2 udp用sendto,tcp用send,好像是这样
picture,
【在 w*s 的大作中提到】 : hi, i'm new to this, many thanks for help ! : trying to send a query packet out, : size 1454 bytes, 1st word 0xfffffffb, 2nd 0xffffffff, 3rd 0x392 : the correct packet sent from c code is captured in wireshark in the picture, : but got this, : socket.error: [Errno 10051] A socket operation was attempted to an : unreachable network : The code is like this, : def send_pnp_query(): : print "... send query ..."
| w*s 发帖数: 7227 | 3 looks like it should be sendto, i'll try again tomorrow.
【在 j*a 的大作中提到】 : udp用sendto,tcp用send,好像是这样 : : picture,
|
|