AF_INET error

Soundwave maybe at
Tue Apr 11 13:39:45 EDT 2000

OK, sorry

here we go

On is a HOWTO guide for creating sockets, i'll give an
example from what is said in the guide

This is the first example

import socket
#create an INET, STREAMing socket
s = socket.socket(
    socket.AF_INET, socket.SOCK_STREAM)
#now connect to the web server on port 80
# - the normal http port
s.connect("", 80)

when I run this code, I get the following output

Traceback (innermost last):
  File "C:\PROGRA~1\PYTHON\TOOLS\IDLE\", line 131, in
    execfile(filename, mod.__dict__)
  File "C:/Program Files/Python/", line 3, in ?
    s = socket.socket(
AttributeError: AF_INET

maybe I look (maybe i even are ?) a bit stupid, but I realy don't know what
it means, or what I am doeing wrong.

Thanx by the way

Fredrik Lundh <effbot at> schreef in berichtnieuws
cHHI4.1202$Za1.20911 at
> Soundwave <maybe at> wrote:
> > I want to learne some things about socket programming, so I started the
> > socet programming tutorial on
> >
> > but when I copy te code from some sample programm's and run it, it
> > work, it don't recognize the AF_INET thing, is this because I am using
> > Windows ??
> >
> > can somebody please explain this to me ?
> >
> > Or what am I doeing wrong ?
> well, since you forgot to tell us what example you tried to
> run, how you typed it in, and what error you got, I can only
> guess.
> -- make sure to import the socket module
> -- make sure to use the "socket." prefix, so Python
>    knows where to look for the AF_INET "thing" (it's
>    a variable).
> </F>

More information about the Python-list mailing list