[Tutor] sockets

Brendon bren@europe.nl.com
Mon, 2 Jul 2001 22:25:12 +0200


On Monday 02 July 2001 22:05, you wrote:
> > with the following code:
> >
> > import sys
> > import socket
> >
> > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> >
> > loginPacket = '<?xml version="1.0" encoding="UTF-8" ?><stream:stream
> > to="jabber.org" xmlns="jabber:client"
> > xmlns:stream="http://etherx.jabber.org/streams">'
> >
> > s.send(loginPacket)
> >
> > data = s.recv(1024)
> > s.close()
> > print "Recieved", data
> > ----
> >
> > i get the error message: s.send(loginPacket) socket.error: (32, 'Broken
> > pipe'). any clue what i'm doing wrong?
>
> I'd suggest taking a look at
> http://www.python.org/doc/current/lib/socket-example.html.
>
> The problem is, you create the socket, but then you aren't connecting it to
> a particular address. Where exactly are you aiming to send the packet to?
> Since you aren't telling it, it's not getting sent anywhere...

hum, true... somehow i must have, er.. overlooked it.
i need to have a little patience and stay off this list for awhile :)

> At a guess, you want to send it back to the same machine. The URL I
> provided gives an example of how to do this....

which i was using, poorly :)

back to the tutorials......

Brendon
-- 

"if we live by an "eye for an eye and a tooth for a tooth"...before long, 
the whole world will be blind and toothless." 
         --Tevye, Fiddler on the Roof