socket troubles
Sean Conley
sconley at cs.csubak.edu
Tue Feb 15 00:20:46 EST 2000
I read the socket how-to and it was of no help. createfilehandler treats
a socket the same as any other filehandle, it just waits for a specific
exception (event) and calls the given callback, straighforward enough. And
as I said, this was a FAR from coplete implementation, I was just trying
to get a very simple client up and running before I worried about
buffering or anything of this nature. I realize this will be necessary in
the final version as heavy traffic on a network can play havok with the
amount of data a socket can accept. Anyhow, your last comment actually
wasn't too far from what my problem was. I simply needed to send a
carriage return at the end of the message. Thise done, it works fine and
I can move on. So, tanks for your suggestion as it seems to have shoved
my thick-headed self in the correct direction. :o)
Sean
On Mon, 14 Feb 2000, Gordon McMillan wrote:
> Sean Conley wrote:
>
> > This problem has me completely stumped. I am trying to write a telnet
> > client (actually a mud client) in Python. The problem is that I can
> > connect and read information from the socket, but nothing seems to
> > happen when I send to the socket.
>
> How do you know that? Does your app freeze? (that would
> indicate the socket isn't writable). Nothing happens? (most
> likely the server is waiting for more - how does the server know
> when you're done sending?) Do you get an exception?
>
> You're not checking how bytes were actually sent. I have no
> idea what createfilehandler does with the socket, although I'd
> guess that's not the problem.
>
> There's a sockets HOWTO on python.org you should probably
> check out.
>
> > I believe it may be a problem with my
> > program, as I had the same problem with Perl/Tk and was unable to solve
> > it there either. So, if anyone has ANY idea why this could be please
> > email me or post here.
>
> My first guess is that you haven't delimited the sent data
> properly, and the server is waiting for more.
>
> - Gordon
>
More information about the Python-list
mailing list