Socket Chatroom server – Creating chat application with sockets in Python

We’ve made it through the basics of working with sockets, and now we’re ready to try to actually build something with them, so, in this sockets with Python tutorial, we’re going to build a console-based chat app.

Text-based tutorials and sample code: https://pythonprogramming.net/server-chatroom-sockets-tutorial-python-3/

Channel membership: https://www.youtube.com/channel/UCfzlCWGWYyIQ0aLC5w48gBQ/join
Discord: https://discord.gg/sentdex
Support the content: https://pythonprogramming.net/support-donate/
Twitter: https://twitter.com/sentdex
Facebook: https://www.facebook.com/pythonprogramming.net/
Twitch: https://www.twitch.tv/sentdex
G+: https://plus.google.com/+sentdex

37 comments

  1. Nabeegh Ahmed on

    I remember your old days bro, that small room and making GTA V AI videos, you have come a long way and it was phenomenal to be a part of this

    Reply
  2. joshua donatante on

    What are these quads you got hung on a wall? Have you already talked about it? I can see some of them may be acrobatic ones! Will you share you point of view on UAVs?

    Reply
  3. Aditya Singh on

    Ayyyye!! You’re back!! I owe you one bro… Your machine learning videos have made a huge boost in my resume!! Thought to inform you that you are making a huge difference!! Love from India !!

    Reply
  4. Koens on

    I love you and your videos sentdex!!! Thanks for all of the incredible content, you’re the reason I started Python! <3

    Reply
  5. Coded Pain on

    I LOVE YOU! I am literally trying to figure out how to make a chatroom server, which only receives messages from clients and delivers them to other clients connected, for a whole week now

    Reply
  6. Muhammad Usman on

    i m promoting your channel in udemy, when ever they say buy this series from us,its good its super cheap i paste your website links down in the comments 😀

    Reply
  7. bloodgain on

    Good start to this tutorial; I’m looking forward to seeing the next part.

    Minor quibble with your receive_message function: since your “good” return value is a dict, it’s really better if you return an empty dict on failure, or at least None, rather than False. Multivariate return types are problematic because they are less predictable to users and require extra — and usually non-Pythonic — handling code everywhere the function is called. Pandas does this, and it drives me nuts, but there’s no other package that approaches what it does. None gets a pass because it’s a non-value, and “may return None” is considered a standard function contract by the Python community — which, of course, you’d say explicitly in your docstring.

    Since both None and empty dict are “falsey”, you can still check with “if [not] message:”, though some “ask forgiveness, not permission” diehards will say you should really just _try_ to access message and handle the empty/None case in the except clause. Note that the latter method is _only_ advisable in Python, though, and using exceptions for flow control is frowned upon in most programming languages.

    Reply
  8. Kune Mohith on

    Hey sentdex, How do you learn/refer docs/sourcecode without an IDE like pycharm/intelliJ. Please tell me a way to refer documentation without internet. How do you do it?

    Reply
  9. Krzych4ever on

    Can someone tell e if I add my test to that and do few minor changes can I post it into my github(with declaration that good portion is from sentdex)?

    Reply
  10. Sébastien Lavoie on

    22:09 The code runs!!! 🙂 Superb tutorial! As always, it’s fun to watch. By the way, if I may, I would suggest splitting long lines so that you don’t have to zoom out. As long as parentheses are used, you can pretty much cut the string wherever you want for any kind of statement, like:
    print(f’Very long {text_variable} going ‘
    ‘here and continuing there. ‘
    ‘Actually with proper indentation of course.’)

    Thank you. Your kitchen must be filled with quite a huge collection of mugs, that’s also entertaining :).

    Reply
  11. Raj Polinovsky on

    Thank you for the video.!
    Very interesting.
    But there are many such examples.
    And how can you make a chat using stur so that you can send messages for NAT?

    Reply
  12. Randy Diaz on

    Someone is cheating on python! lol false, true is javascript/c++/java/Go. Also note that you can do

    if not message:

    instead of

    if message is False:

    Reply
  13. Андрей локас on

    oooo wow you are just superb!!
    its my fav tutorials 🙂
    hope you do full course tutorials for python!
    thanks !!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Show Buttons
Hide Buttons