I'm trying to write a little script to send data to another machine, and just read any message I get in return.
so I do something like:
import socket
import select
s = socket.socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)
s.connect((<host>, <port>))
s.send('sometext')
[input, output, error] =
select([s.fileno()], [], [])
if s.fileno() in input:
result = s.recv(1024)
<do some stuff with result>
else:
<do something else>
It sends the data correctly, and I am portscanning my network and I should be getting some kind of response, but the select just blocks. I know I can set a timeout and set the socket to be non-blocking, but I know that the remote machine has sent a response and I don't know why I am not receiving it.
Can anyone help?
so I do something like:
import socket
import select
s = socket.socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)
s.connect((<host>, <port>))
s.send('sometext')
[input, output, error] =
select([s.fileno()], [], [])
if s.fileno() in input:
result = s.recv(1024)
<do some stuff with result>
else:
<do something else>
It sends the data correctly, and I am portscanning my network and I should be getting some kind of response, but the select just blocks. I know I can set a timeout and set the socket to be non-blocking, but I know that the remote machine has sent a response and I don't know why I am not receiving it.
Can anyone help?