|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
||||
|
||||
|
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. |
|
#3
|
||||
|
||||
|
Two thumbs from me:
Any chance to get to client code? I'd like to test your server ![]() Grim
__________________
*** Experimental Python Markup CGI V2 *** |
|
#4
|
|||
|
|||
|
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. |
|
#5
|
||||
|
||||
|
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. |
|
#6
|
||||
|
||||
|
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. |
|
#7
|
|||
|
|||
|
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. |
|
#8
|
||||
|
||||
|
Im doing the same thing.. except that i will have client & server in one
![]()
__________________
IE QUOTE | PHP Manual | Google | C/C++ Compiler | Linux Tutorials | General Stuff Game Dev |
|
#9
|
|||
|
|||
|
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. |
|
#10
|
||||
|
||||
|
I keep mentioning Boa,
but it does have a tutorial that shows the basics of wxPython from a Boa perspective.Grim ![]() |
|
#11
|
|||
|
|||
|
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. |
|
#12
|
||||
|
||||
|
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. |
|
#13
|
|||
|
|||
|
@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. |