Hi, I'm trying to use raw socket to make TCP connections and send HTTP GET requests, but honestly I'm a totally beginner of network programming so I met some problems when coding.
In README.md, send() function is declared as socket.send (buffer, offset, length, address, beforeCallback, afterCallback), but when I print the req in onSendReady(), the real object is this:
So the before callback and the after callback seems to be placed in wrong place? I'm not sure whether this is the source of my problem, because the error message is made up of some mojibake:
Error sending packet: Error: �ṩ��һ����Ч�IJ�����
at Socket.onSendReady (C:\Users\funct\Desktop\node-socket\node_modules\raw-socket\index.js:102:14)
at SocketWrap.emit (node:events:518:28)
PS: when I added another function(() => {console.log("ready");}) as the fifth parameter, the error message disappeared and Packet sent successfully undefined was printed in the console. However I just couldn't catch that package in wireshark, so this was another failure.
Hi, I'm trying to use raw socket to make TCP connections and send HTTP GET requests, but honestly I'm a totally beginner of network programming so I met some problems when coding. In README.md,
send()
function is declared assocket.send (buffer, offset, length, address, beforeCallback, afterCallback)
, but when I print thereq
inonSendReady()
, the real object is this:So the before callback and the after callback seems to be placed in wrong place? I'm not sure whether this is the source of my problem, because the error message is made up of some mojibake:
And here is my code, thanks for your reading.
PS: when I added another function(
() => {console.log("ready");}
) as the fifth parameter, the error message disappeared andPacket sent successfully undefined
was printed in the console. However I just couldn't catch that package in wireshark, so this was another failure.