Message66244
This is the result from executing the second IPv4/IPv6 server example
shown in socket module documentation on a FreeBSD-7 system.
http://docs.python.org/dev/library/socket.html#example
dhcppc1# cat server.py
# Echo server program
import socket
import sys
HOST = '' # Symbolic name meaning the local host
PORT = 50007 # Arbitrary non-privileged port
s = None
for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC,
socket.SOCK_STREAM, 0, socket.AI_PASSIVE):
af, socktype, proto, canonname, sa = res
try:
s = socket.socket(af, socktype, proto)
except socket.error, msg:
s = None
continue
try:
s.bind(sa)
s.listen(1)
except socket.error, msg:
s.close()
s = None
continue
break
if s is None:
print 'could not open socket'
sys.exit(1)
conn, addr = s.accept()
print 'Connected by', addr
while 1:
data = conn.recv(1024)
if not data: break
conn.send(data)
conn.close()
dhcppc1#
dhcppc1# uname -a
FreeBSD dhcppc1# 7.0-RC1 FreeBSD 7.0-RC1 #0 Mon Dec 24 12:18:24 UTC 2007
root@logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC o386
dhcppc1#
dhcppc1# python2.5 server.py
Traceback (most recent call last):
File "server.py", line 8 in <module>
for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC,
socket.SOCK_STREAM, 0, socket.AI_PASSIVE):
socket.gaierror: (8, 'hostname nor servname provided, or not known')
dhcppc1# |
|
Date |
User |
Action |
Args |
2008-05-04 21:51:53 | giampaolo.rodola | set | spambayes_score: 0.00378189 -> 0.0037818938 recipients:
+ giampaolo.rodola, georg.brandl |
2008-05-04 21:51:53 | giampaolo.rodola | set | spambayes_score: 0.00378189 -> 0.00378189 messageid: <1209937912.94.0.0729718790941.issue2763@psf.upfronthosting.co.za> |
2008-05-04 21:51:51 | giampaolo.rodola | link | issue2763 messages |
2008-05-04 21:51:50 | giampaolo.rodola | create | |
|