Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    217
    Rep Power
    0

    Chat Server Version 0.1


    As you may or may not know, I've been writing a small chat server and chat client. It's not done yet (my todo list is in the file ) but I wanted to post it here for any suggestions. I would appreciate any help on how to make the code 'better'. Thanks in advance.

    Btw, I havn't included the client as it is just used for debugging atm.
    Attached Files
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69

    Thumbs up


    Impresive, clean and highly OOP! Looking very good so far . Will have a sit down and read though it a little latter. I'll let you know more then .

    Mark.
    programming language development: www.netytan.com Hula

  4. #3
  5. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13

    Thumbs up This is looking good!


    Two thumbs from me:

    Any chance to get to client code? I'd like to test your server

    Grim
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    217
    Rep Power
    0
    Thanks for the kind words . As for the client, I've attached it here. Hopefuly you can figure it out as it's kind of a mess and uncommented. Sorry I can't say much more now because I'm just heading out!

    Btw, my friend is writing a GUI client in Perl and should be done soon.
    Attached Files
  8. #5
  9. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    There was a little problem with your client - port isn't defined. Just check em on this one, the port number should be 50007 right?

    Why perl; surly a Python GUI client would be better since the server is Python?

    Edit: My bad. The port number should have been supplied though sys.argv... i'm on windows so i just double clicked .

    Mark.
    Last edited by netytan; March 13th, 2004 at 03:44 PM.
    programming language development: www.netytan.com Hula

  10. #6
  11. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    A little lost, i started the server and two clients (both would have the same IP, not sure if that makes a differance but it might explain some things) but i cant get either to echo in the server window or the other client window.

    Maybe you could talk us though a simple server-client test?

    Mark.
    programming language development: www.netytan.com Hula

  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    217
    Rep Power
    0
    Hi, I'm at a friends so I'll need to make this quick. You need to specify a port and a nickname at the command line and optionaly an address.

    I probably should have documented it a bit better before posting, sorry. But here is a quick tutorial:

    From the client:
    say <message> to send a global message (like on irc)
    pm <name> <message> to send a private message
    pmlist to view all your private messages
    messages to view normaly messages (from "say")

    From the server:

    global <message> to send a global message.
    dump to view a raw dump of everything sent out


    Uhh I can't think of much more atm, but I'll post again tomarrow. I hope this helps for now.
  14. #8
  15. Only the strong survives!!.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Feb 2003
    Location
    A World of wonders.
    Posts
    5,583
    Rep Power
    407
    Im doing the same thing.. except that i will have client & server in one
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    217
    Rep Power
    0
    That client at the moment isn't really usable for a conversation as you need to type a command to send a message and a command to view your messages. I'll post the Perl client and the new server when they're done. The Perl client will look somewhat like mIRC. We're trying to mimic something like IRC rather than MSN, AIM or Yahoo IM.

    Btw, the reason for no Python GUI client is that I havn't found many tutorials for wxPython.
    Last edited by XxChris; March 14th, 2004 at 09:35 AM.
  18. #10
  19. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    I keep mentioning Boa, but it does have a tutorial that shows the basics of wxPython from a Boa perspective.

    Grim
  20. #11
  21. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    217
    Rep Power
    0
    I'll look into it, thanks . Btw, has anyone had any troubles with the server or client? Is it working properly?
    Last edited by XxChris; March 14th, 2004 at 12:20 PM.
  22. #12
  23. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    If by trouble you mean failure to get it working then you can count me in . For some reason couldn't get the clients to talk with each other, possibly because both the IP addresses are the same but...

    Mark.
    programming language development: www.netytan.com Hula

  24. #13
  25. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    217
    Rep Power
    0
    @netytan:

    The IP addresses won't affect it as the server uses threads and sockets to differenciate between clients. Here is a little tutorial:

    Start the server up:

    Code:
    ./chatserver.py 1024
    Start two clients up:

    Code:
    ./chatclient.py 1024 Chris
    ./chatclient.py 1024 Mark
    Now, using the server console you should be able to type "users" and see both of those clients:

    Code:
    [Aurora:python/projects/chat] chris% ./chatserver.py 50007
    > users
    127.0.0.1       Mark
    127.0.0.1       Chris
    You can use the "online" command from either client to get the same effect. Now, since it's just a simple text based client (for debugging) you need to use a command to send a message, and another to view messages. Using "say <message>" from either client will send a message. Use "messages" on the opposite client to view it:

    Code:
    [Aurora:python/projects/chat] chris% ./chatclient.py 50007 Chris
    > say Hi, Mark
    Code:
    [Aurora:python/projects/chat] chris% ./chatclient.py 50007 Mark
    > messages
    Chris: Hi, Mark
    With the "name <newname>" command you can change your name to whatever you like, as long as it isn't used already. You can use the "events" command from the server console to view things like name changes, disconnections or connections.

    Code:
    [Aurora:python/projects/chat] chris% ./chatclient.py 50007 Chris
    > say Hi, Mark
    > name christofer
    > say I changed my name!
    Code:
    [Aurora:python/projects/chat] chris% ./chatserver.py 50007
    > users
    127.0.0.1       Mark
    127.0.0.1       Chris
    > events
    127.0.0.1       Mark    Connected
    127.0.0.1       Chris   Connected
    127.0.0.1       Chris   Name: christofer
    Code:
    [Aurora:python/projects/chat] chris% ./chatclient.py 50007 Mark
    > messages
    Chris: Hi, Mark
    > online
    Mark
    christofer
    > messages
    Chris: Hi, Mark
    christofer: I changed my name!
    There is other stuff like private messages ("pm <user> <message>" and "pmlist" to view your PMs), also you can use "dump" from the server console to view everything it has sent out.

    Code:
    [Aurora:python/projects/chat] chris% ./chatclient.py 50007 Mark
    > pm christofer Your confusing me!
    Code:
    [Aurora:python/projects/chat] chris% ./chatclient.py 50007 Chris
    > pmlist
    Mark: Your confusing me!
    > messages
    Chris: Hi, Mark
    christofer: I changed my name!
    File sending is comming soon . Oh, and "quit" quits the server. The clients don't have any clean way to quit atm (It's not really meant to be used ). I hope this helps!
    Last edited by XxChris; March 14th, 2004 at 02:06 PM.
  26. #14
  27. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    217
    Rep Power
    0
    Btw, here is an early picture of the client: http://geocities.com/idontthinkalot/chat.JPG

    (It is the chatz0r window )
  28. #15
  29. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Ok, after a failed attempt or two i have it passing messanges quite although my results differ slightly from yours i.e. USERLIST: likes to be printed along with certain commands...

    Code:
    C:\Documents and Settings\Mark>desktop\chatclient.py 50007 mark
    > online
    markUSERLIST:
    dcUSERLIST:
    > messages
    dcUSERLIST: :hey
    > say hey
    >
    what ya think? a little bug?

    Mark.
    programming language development: www.netytan.com Hula

Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo