sockets and classes

Robert Amesz reqhye72zux at mailexpire.com
Tue Jul 31 23:11:09 EDT 2001


> I don't get error messages while executing irc.sendcmd(), but it
> doesnt work. I should recieve a response fromt he server after
> sending USER and NICK, then another response after sending JOIN. 
> But, I get nothing.  Whats up!? PS:  This is my first attempt to
> program using classes, and perhaps I'm not doing it right?

You underestimate the complexities of the IRC protocol. You MUST 
respond appropriately (and timely!) to each PING the server sends, and 
the server  *will* have sent you a PING when you tried to log in. Oh, 
yes, the pinging will continue with more-or-less regular intervals 
throughout the session, asynchronously. (If you want to observe what's 
going on, just use a telnet program and try logging in by hand. Set 
local echo on.)

Yes, IRC works asynchronously: the IRC-server will send you data 
anytime it wants to, it's not a command/response protocol like POP3 or 
NNTP. Which means your entire app must work asynchronously. Which in 
turn means you'll need to work with non-blocking sockets *or* use a 
module like asyncore. Whatever you choose, it'll be an interesting 
learning experience. Mind you I'm not trying to discourage you, but 
you've underestimated the amount of work to make an IRC-class by at 
least an order of magnitude.

Consider: there's more to IRC than RFC1459. There's RFC2810, RFC2811, 
RFC2812 and RFC2813 too, although the 28xx RFC's really are just 
updated versions of RFC1459. More importantly, what isn't covered by 
those is the CTCP, the client-to-client protocol, which is described in 
a separate document, which *isn't* an RFC. You really must implement 
this protocol, it's a separate protocol on top of the IRC protocol. The 
DCC-protocol is yet another separate (non-RFC)protocol, but an optional 
one, fortunately.

BTW, you'd better use a locally installed IRC-sever for your 
experiments: it saves bandwidth, and the operator of the server you're 
using now might not like being used as your guinea-pig. Oh, he wouldn't 
have noticed a few failed logins, but if you flood his server by 
accident he *will* notice and won't be pleased. As IRC-servers 
frequently are the victim of all sorts of hacking activities the 
operator might not be too indulgent.


Robert Amesz



More information about the Python-list mailing list