On 13/12/2011 16:50, Sagy Drucker wrote:
hello
Hi
i am relatively new to python, so please be considerate...
As I am only responding to one of your questions, perhaps it would be
best if you don't get any other more helpful replies to split your
questions up and post them separately.
i'm implementing a server and a client via raw_sockets.
i have the necessary privileges.
now, the server i defined so:
host = socket.gethostbyname(socket.gethostname())
address = (host, 22224)
sockSer = socket.socket(socket.AF_INET, socket.SOCK_RAW,
socket.IPPROTO_ICMP)
sockSer.bind(address)
sockSer.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON)
packet, addr = sockSer .recvfrom(4096) # wait for packet from client
Q1) why can't i simply type: hosts = 'localhost'.
if i do so, it doesn't allow me to write the line:
sockSer.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON).
only when doing gethostbyname(socket.gethostname()) i get
192.168.1.101
and then it works.
<cut other questions>
Well localhost should resolve to 127.0.0.1/8 which is attached to the
loopback interface, my gut feeling is that this interface has a
particular set of restrictions which you are encountering.
Sorry I can't be more helpful.
--
mph
--
http://mail.python.org/mailman/listinfo/python-list