Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
What does it take to implement a chat system in Python (Not askingfor code just advice before I star
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Chris Angelico, post: 5105801"] A good thing to start with. Yes, it's been done before, many times... but if you think about it, it's the fundamental on which pretty much everything else is derived. The step from a multi-person chat system to a multiplayer game is very slight. Learn network programming, definitely. As an adjunct to that, learn networking security. For instance, do not think in terms of "the client will only ever send X"; the server has to be able to cope, safely, with any stream of bytes coming from the socket. Also, be sure you understand the difference between bytes (or octets) and Unicode characters, and know what everything is. Python 3 helps with this. Finding hosting (I'll use the word "server" here to mean the program, and will say "hosting" when I mean a computer) is optional though; for your first tests, use your own computer. You can run the server and a number of clients all on the same computer, and alt-tab between them; or, if you have a LAN, you can use that. Then when you want to expand to the full internet and let your friends in on this, you can still host it on your home internet connection, though you may need to choose carefully which port you use (some home connections prevent incoming port 25 and 80 traffic). You won't need to worry about hosting until (a) you need it to be up 24x7 and don't want to depend on your home system, and/or (b) you need more bandwidth/processing than your home connection will do. Neither will be true of your first experiments. GUI development, in my opinion, should be left for Phase Two. Start by making a very simple system that just works with plain text; later on, make a fancy graphical interface. Keep the text version working, and keep them compatible. Trust me, you'll appreciate that text one when you start debugging - it'll be so easy to see what's going on. Hmm. I would think not; I'd recommend that a chat system work with TCP sockets directly, for simplicity and performance. Working with a web framework implies working with HTTP, and unless you're running this in a web browser, there's no reason to do that. Optional. Leave that for Phase Two; to start off with, just let people type in their own names, and don't worry about authentication initially (this isn't such a crazy idea - IRC largely works this way). You can add authentication later. Get to know as many tools as you can, so that when you're faced with a problem, you can select the right one for the job. You are not Jeremy Clarkson, your toolchest is not all hammers :) In this particular instance, you may find that Python is the best language for the clients, but not for the server. I've written a number of chat-server-like systems, most notably MUD clients and derivatives, and I use Pike for the server. Its biggest advantage (over Python) is that you can tweak the code while it's running; I've had Pike servers running for over two years on commodity hardware (and would still have that uptime today if the UPS hadn't died). Still trying to claw all that back.. up to 25 weeks so far. Pike and Python are extremely similar in semantics (even down to having a nearly-identical internal string representation, as of Python 3.3), but have distinctly different syntax (Pike looks like C), and their optimizations are quite different, so performance varies somewhat. They're both high level languages that let you manipulate functions, dictionaries, etc, as first-class objects, they're both sufficiently high performance/efficiency to run something like this on 0.00 load average (my server's load is more usually from Apache serving PHP pages than it is from either Pike or Python), and both will serve you well in this project. One more tip: Don't be afraid to ask for help! I personally *love* networking, and will gladly help out with any little problems you run into; the same, I am sure, will be true of a good number of people on this list. Networking is a complicated world, and there are a lot of odd concepts to master; but it's also an immensely fun bunch of technologies. Why play with just one computer when you can play with half a dozen! ChrisA [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
What does it take to implement a chat system in Python (Not askingfor code just advice before I star
Top