i am a newbie with python and i did this program copied from internet (on debian woody with python 2.1):
# sockets
import sys
from socket import *
#create an INET, STREAMing socket
Sock = socket(AF_INET,SOCK_STREAM)
Sock.connect(('www.google.com',80))
#now connect to the web server on port 80
# - the normal http port
msg = ''
while len(msg) < MSGLEN:
chunk = Sock.recv(MSGLEN-len(msg))
if chunk == '':
print "socket connection broken"
sys.end()
msg = msg + chunk
totalsent = totalsent + sent
print msg
sys.end()
i get this error from python :
Traceback (most recent call last):
File "mailer.py", line 7, in ?
Sock = socket(AF_INET,SOCK_STREAM)
NameError: name 'socket' is not defined
so, where is defined socket if not in sockett module?
