由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - python question: A socket operation was attempted to an unreachable network
相关主题
有没有人在Vista下试过UDP广播想知道家在linux下都有什么c++ socket library
How to get local hostname under linux?Windows下大家都用什么SqlConsole啊?
Linux Socket编程question about using Hive parameter (转载)
求解:socket client用node.js, socket server用c++Querying JSON in Postgres
socket re-connection problemQuestion about Base Tag...
unix network programming (Stevens) book V1 (2ed, 3ed) code cannot run on LinuxAny chinese MUD in USA?
一个socket中select函数的问题常用的调试网络的命令,除了ping和traceroute,还有什么? (转载)
C10M 练习2: 空TCP 连接,1M per 4G RAMUNIX DATAGRAM 类型socket最大报文长度多少?
相关话题的讨论汇总
话题: msg话题: 0xff话题: attempted话题: socket
进入Programming版参与讨论
1 (共1页)
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,

1 (共1页)
进入Programming版参与讨论
相关主题
UNIX DATAGRAM 类型socket最大报文长度多少?socket re-connection problem
怎样把snoop的文本结果抽出来?unix network programming (Stevens) book V1 (2ed, 3ed) code cannot run on Linux
如何截取浏览器向服务器发送的数据一个socket中select函数的问题
问一个Linux无法监听指定端口的问题C10M 练习2: 空TCP 连接,1M per 4G RAM
有没有人在Vista下试过UDP广播想知道家在linux下都有什么c++ socket library
How to get local hostname under linux?Windows下大家都用什么SqlConsole啊?
Linux Socket编程question about using Hive parameter (转载)
求解:socket client用node.js, socket server用c++Querying JSON in Postgres
相关话题的讨论汇总
话题: msg话题: 0xff话题: attempted话题: socket