[Tutor] Looking for some constructive peer review.

Chris Hengge pyro9219 at gmail.com
Fri Nov 10 08:28:33 CET 2006

Yeah, I'm trying to hold out on gui stuff at the moment. I'm trying to get a
grasp on classes and threads at the moment because nothing I've made to date
in python really calls for anything outside of what a console can offer.
Kinda keeping it simple for now I guess... I'll probably rebuild this
application with a gui in the not-so-far future though.. would make a great
starter for gui's project. (I'm pretty good in C# with gui's so I might just
go with IronPython so I can use the windows libs for the interface controls,
well see =D )

As for the IRC style (as in I know I could just get a library, but I
wouldn't really learn anything. I also know fairly well how IRC should act,
so its a good model for my learning) project, I dont need to reinvent it,
but basically a threaded multiuser experience would be cool... I'm also
interested in programming the server (threaded project for more practice).
My original trials with the code I posted for this thread where seperate
client and server code, and I ran several threads so I could get multiple
connections and print content to the server console from the client console,
and then return fixed messages back, but I am not sure how I'd go about
letting multiple users communicate to each other, or forward messages. Does
this involve traversing threads? or sockets? or something else? Thanks.

On 11/9/06, Luke Paireepinart <rabidpoobear at gmail.com> wrote:
> Chris Hengge wrote:
> > I write this little IM style client the other night based on some
> > sample socket and threading examples I found plus a little of my own
> > twist just to make it more interesting..
> > I'd like some constructive peer review just to help me make sure I'm
> > doing this correctly / well.
> >
> > You can test it by connecting to localhost if you want to run the code
> > to help with review. One thing I'd like to know how to do is fix the
> > output to the screen. Currently it interrupts typing when a message is
> > recieved which as I understand is because my typing a line is
> > basically letting the client thread sleep, and recieving a message
> > triggers the server thread while I'm typing... Maybe there is some
> > sort of better thread management for this? Or is this just a limiting
> > factor since I'm playing in the console world? The other issue I have
> > is when the other person types DSC to end their session, I should be
> > able to put the thread to sleep, or trash it or something so I dont
> > have to close the app to use it again. It also isn't going through the
> > entire
> >
> > I was hoping to actually make something more like an IRC server /
> > client, but I'm not sure I've got this thing down well enough to try
> > that. Thanks!
> Sorry, I'm too tired to read your code right now.
> A few things I'd like to point out...
> yeah, it's tough to show output and get input in the same console
> window.  A simple TKInter gui would not be all that hard to put together.
> Just a textbox and an entry widget.
> wouldn't even need a 'send' button if you just bind 'enter' to the send
> command from the entry widget.
> Also, IRC is not as complicated as you may think.  The messages are all
> in ascii.
> Basically you just say
> import socket
> sock = socket.socket()
> sock.connect(('irc.freenode.net',6667))
> sock.send("NICK Bob\r\n")
> sock.send("USER Bob irc.freenode.net bla :realname\r\n")
> sock.send("JOIN #test\r\n")
> sock.send("PRIVMSG #test HELLO!\r\n")
> sock.send("LEAVE #test\r\n")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061109/80ff3935/attachment.htm 

More information about the Tutor mailing list