Simple TCP Chat Room in Python

  Рет қаралды 202,361

NeuralNine

NeuralNine

Күн бұрын

This is one of the most requested video tutorials. Today we will build a simple TCP chat room consisting of a server and multiple clients that can connect to this server and chat with each other.
Blog Post: www.neuralnine.com/tcp-chat-i...
◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
📚 Programming Books & Merch 📚
💻 The Algorithm Bible Book: www.neuralnine.com/books/
🐍 The Python Bible Book: www.neuralnine.com/books/
👕 Programming Merch: www.neuralnine.com/shop
🌐 Social Media & Contact 🌐
📱 Website: www.neuralnine.com/
📷 Instagram: / neuralnine
🐦 Twitter: / neuralnine
🤵 LinkedIn: / neuralnine
📁 GitHub: github.com/NeuralNine
🖥️ My Coding Setup 🖥️
⌨️ Keyboard: hyperurl.co/neuralkeyboard
🖱️ Mouse: hyperurl.co/neuralmouse
🖥️ Monitor: hyperurl.co/neuralmonitor
🎙️ Microphone: hyperurl.co/neuralmicrophone
✏️ Drawing Tablet: hyperurl.co/neuraldraw
🎵 Outro Music From: www.bensound.com/
◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
Timestamp
Intro: (0:00)
Coding Server: (0:38)
Coding Client: (16:20)
Demonstration: (22:47)
Outro: (24:43)

Пікірлер: 358
@mwolfe1215
@mwolfe1215 4 жыл бұрын
Thanks for the great video! The only one that I've found that explains the code understandably and isn't terribly advanced. Very helpful!
@getoverhere4465
@getoverhere4465 3 жыл бұрын
This has actually been more helpful than most videos about this subject. Thank you.
@BCS_MohdMaaz-bm8vu
@BCS_MohdMaaz-bm8vu Жыл бұрын
This is one of the best video on TCP chatroom using python. You explained it simply and very thoroughly.
@basharghanem4669
@basharghanem4669 3 жыл бұрын
Dude, you are the most underrated person in youtube, I never saw such a skilled programmer like you!!! I really wonder where did you study.
@AlienRmix
@AlienRmix 3 жыл бұрын
Dude,you are like the first person on here that I watched and actually understood and everything worked as it was supposed to. Also you don't do that shit when someone writes codes for like 5 minutes then deletes it just because he is showcasing something,so I have to delete too and be ultra frustrated by the pointless example and waste of time writing something. I wish you the best of luck in the future with these videos,you gained me as a sub and I am even looking at your books on Amazon right and considering to buy them.
@sleepyspeller7805
@sleepyspeller7805 2 жыл бұрын
Thank you a lot for making this tutorial! It's easy to follow, understand, and easy to modify the code for adding custom stuff like commands, etc... Just subbed, thank u a lot!
@shahanahmed952
@shahanahmed952 3 жыл бұрын
Great Project bro, Especially love your commentary and explanations as you code(Super Helpful). Keep up the good work!🧠🔥🔥
@tharunkumaar2068
@tharunkumaar2068 3 жыл бұрын
The most detailed and understandable video i can find online thanks very much
@maximepivi
@maximepivi Жыл бұрын
those design patterns video tho. that what brought me here. im studiying ccna dev ops. but i stay for the rest. its amazing how clear ur contend is and practical. ggs
@DavuGames
@DavuGames Жыл бұрын
Porządna robota!
@federicobau8651
@federicobau8651 Жыл бұрын
When a pro decides to make tutorials, is a bless really
@cristiansan
@cristiansan 3 жыл бұрын
line 7 from client have the port 55555 (with an extra 5), in the server there are only 4. Thanks for sharing, very nice project!
@dineshbabu0
@dineshbabu0 2 жыл бұрын
How to open it on command prompt
@leagueofdraven3355
@leagueofdraven3355 Жыл бұрын
Wow, my teacher requested to do this chat as our final assignment for his class, I have searched through a lot of videos and your is by far the best and the one which has explained the most how it works. Keep it up with the good stuff man!
@BlockBuilder0
@BlockBuilder0 4 ай бұрын
so ur cheating...
@coleberr4595
@coleberr4595 4 ай бұрын
@@BlockBuilder0 how else do you learn
@davidebanale1928
@davidebanale1928 3 жыл бұрын
Your Content is amazing! Please never stop doing videos! I'm your fan now!
@jeancardona143
@jeancardona143 3 жыл бұрын
Hello sir, awesome tutorial. I’m really grateful for the quality content you provide to us, thanks.
@Joemama-jm2sl
@Joemama-jm2sl 3 жыл бұрын
DUDE,YOU HELPED ME SO MUCH. Its working very fine and i made it having more features like mining system! Thanks bro!
@erfanagheli1644
@erfanagheli1644 2 күн бұрын
Bro, I just wanna say I learnt a lot from since past year... I think you deserve at least a thank you.
@Nobody65737
@Nobody65737 4 жыл бұрын
Just wanna say, I'm a huge fan of your work, you've been really articulate and detailed. Looking forward for more. And yes an emoji feature with an admin role would be nice.
@NeuralNine
@NeuralNine 4 жыл бұрын
Thank you! And I will probably make a second part yes! :)
@AcademyOmen
@AcademyOmen 3 жыл бұрын
Yeah nice one
@mosesjonathan1240
@mosesjonathan1240 2 жыл бұрын
i know im asking the wrong place but does anyone know of a tool to log back into an instagram account..? I was stupid forgot the password. I love any help you can offer me.
@Nobody65737
@Nobody65737 2 жыл бұрын
@@mosesjonathan1240 just reset it
@skylarkendrick656
@skylarkendrick656 2 жыл бұрын
@Moses Jonathan instablaster :)
@Radical9535
@Radical9535 9 ай бұрын
awesome this video made me understand how to structure my files after trying to figure that out for too long. so thanks!
@Azazog
@Azazog 3 жыл бұрын
Really enjoyed the video dude! Learned a heap, subscribed for more.
@kn9987
@kn9987 Жыл бұрын
Very interesting video with perfect example of threading and socket
@VikramReddyAnapana
@VikramReddyAnapana 2 жыл бұрын
Wonderful, great presentaion and execution.
@konnehjonny8686
@konnehjonny8686 3 жыл бұрын
Thank you so much, this tutorial is the number 1, in this 2020 in the field of understanding the server and client interconnection. Please if you can work on the kicking and Emoji feature will be another BOOM!!BOOM!
@johntheocharis573
@johntheocharis573 2 жыл бұрын
BRUH YOU DESERVE A SUB IM REALLY SURPRISED! It works!
@hello-my6ot
@hello-my6ot 3 жыл бұрын
It is so clear and its exactly what i wanted tnx dude
@hebert6121
@hebert6121 3 жыл бұрын
just amazing!
@jyotirmay8646
@jyotirmay8646 3 жыл бұрын
Everything works fine. Thank you so much sir! All your tutorials lead me to learn something new everytime I watch them. I just had to ask one thing. If I want to use this chat over WAN, do I need to port forward it from my router or simple connect the client to the wan ip of the server computer? I dk much about socketing so I thought maybe asking you directly would help.
@andrejbatarilo2703
@andrejbatarilo2703 3 жыл бұрын
Such a good video, thank you!
@martinHm
@martinHm 5 ай бұрын
perfect! 🔥
@kamronzamirov3777
@kamronzamirov3777 Жыл бұрын
Genius man!
@sf-gt9co
@sf-gt9co 3 жыл бұрын
keep going, that's a great channel!
@P-AaryanSarda
@P-AaryanSarda 3 жыл бұрын
thank you very much for this tutorial, big fan
@noobythicc1484
@noobythicc1484 3 жыл бұрын
Thanks man, really helped me.
@prateeksarangi9187
@prateeksarangi9187 Жыл бұрын
Thanks Mate ! Great content
@maulikshah28
@maulikshah28 3 жыл бұрын
I love your work sir
@ukaszjaremek4383
@ukaszjaremek4383 3 жыл бұрын
You really can teach! Thanks for video
@NeuralNine
@NeuralNine 3 жыл бұрын
Thank you! :)
@saivarunnamburi6195
@saivarunnamburi6195 4 жыл бұрын
Yeyy this is really awesome 👌 You have explained it clearly without any doubts in mind. Yes, we really want many more parts for this project like kicking, emojis, adding other clients etc... We will wait for part 2 of this project. Thanks 😊 for ur wonderful explanation
@NeuralNine
@NeuralNine 4 жыл бұрын
Thank you very much! I will do a video in the future! :)
@dineshbabu0
@dineshbabu0 2 жыл бұрын
How to open it on command prompt
@muhammadukkasha5030
@muhammadukkasha5030 11 ай бұрын
best one, keep the good work going
@georgeli6820
@georgeli6820 2 жыл бұрын
Great tutorial!
@ionvud3649
@ionvud3649 3 жыл бұрын
Отличный урок ! Продолжай тему
@Clasher_7617
@Clasher_7617 2 жыл бұрын
TYY MAN I LOVE YOUR CHANNEL!
@vihanprashant9702
@vihanprashant9702 2 жыл бұрын
je suis tres excite pour ton video prochain
@adiyansd4356
@adiyansd4356 2 ай бұрын
YOU DESERVE A MILLION OR i think MORE THAN MILLION
@alexwalls9700
@alexwalls9700 3 жыл бұрын
Lol, your video really helped me, thanks Bro 👌
@r0ck3th76
@r0ck3th76 3 жыл бұрын
Thanks finally found a good tutorial! please make more
@amantarar9077
@amantarar9077 3 жыл бұрын
Nice man 👍
@sahilamin5509
@sahilamin5509 3 жыл бұрын
You are my hero
@adityaagarwal6935
@adityaagarwal6935 4 жыл бұрын
Really curious to know how you go about the kicking and emoji feature you are talking about. Also if possible show how to use this as a webapp. Love your content tho!
@NeuralNine
@NeuralNine 4 жыл бұрын
Thank you! I plan on doing a part two! :)
@bangraph1379
@bangraph1379 3 жыл бұрын
Great vid thanks✌🏻
@adetricahya410
@adetricahya410 2 жыл бұрын
thank you, god bless you
@SakyantOrg
@SakyantOrg Жыл бұрын
great tutorial man
@btugu_1699
@btugu_1699 3 жыл бұрын
Gr8 vid
@user-kx4vu5zt4p
@user-kx4vu5zt4p 3 жыл бұрын
Very very thanks
@15.AAYUSHI-lm3su
@15.AAYUSHI-lm3su 8 ай бұрын
thankyou sir
@OlaDuda
@OlaDuda 3 жыл бұрын
Omg, I love it! I understand this whole processes even more O.o Thank you and keep up with good job :)
@cadettomal2205
@cadettomal2205 3 жыл бұрын
love you bro
@hamidshah09
@hamidshah09 Жыл бұрын
very important to mention here that windows firewall plays important role in server-client communication. Therefore, don't forget to add exception in firewall by adding new inbound rule for port 9090 or what ever server is listening on...otherwise it won't work from another computer
@ishaan8526
@ishaan8526 Ай бұрын
How do u do this
@amaldeeppatra8224
@amaldeeppatra8224 3 жыл бұрын
Amazing video sir! One thing I would like to ask that does this work in Python 3.4 on a Windows 7, 32 bit ?
@wahwahwally1
@wahwahwally1 18 күн бұрын
great video and explanation, how would you recommend that we gracefully close the server?
@mvsprabash
@mvsprabash 3 жыл бұрын
Thank you so much...
@originals2747
@originals2747 3 жыл бұрын
Well I just added some features . The server now records the messages. There is no privacy
@bravishghosh2835
@bravishghosh2835 4 жыл бұрын
Please add clicking and banning and emoji etc. Also if possible try to deploy this into a webapp...just like making your own chat based application!
@NeuralNine
@NeuralNine 4 жыл бұрын
If enough people are interested in it, I will make additional parts :)
@pranaytiwari9204
@pranaytiwari9204 4 жыл бұрын
Yes we are intrested
@RoyalFGaming
@RoyalFGaming 3 жыл бұрын
@@NeuralNine Would definitely follow along w that! Thanks for the great vids:))
@michaelguch3279
@michaelguch3279 3 жыл бұрын
@@NeuralNine Am really Interested in it too. Thanks for the good job
@spizee2660
@spizee2660 3 жыл бұрын
Pls make a video on that
@kushgrandhi3708
@kushgrandhi3708 4 жыл бұрын
Really love your work, please add more options to the chat room
@NeuralNine
@NeuralNine 4 жыл бұрын
I will! :)
@razzawazza
@razzawazza 3 жыл бұрын
Great video thanks for uploading. I have a dumb question- line 46 why is there an extra comma at the end after 'client'?
@maturamgoel5330
@maturamgoel5330 3 жыл бұрын
Very nice tutorial please make a Chat Gui with this same client server please...🙄
@kt6ddb643df
@kt6ddb643df 3 жыл бұрын
I'm waiting for the part 2.
@samuelchristsonwilson7164
@samuelchristsonwilson7164 3 жыл бұрын
Wanna know the way to build all this as p2p chat room... Thanks for the contain of this video. Hope you'll make more... It helps...
@gfjwgldwzqfdkgdhdfdjledkdd9856
@gfjwgldwzqfdkgdhdfdjledkdd9856 2 жыл бұрын
Im very interested in this you helped me really you have the best tutorials but i have a question can i chat with my friend when he is on another pc?
@prashanthbabu1397
@prashanthbabu1397 8 ай бұрын
@NeuralNine I really enjoyed this video and learned a lot from it.I just had one question, my server and client works, but the only problem is that when i run two clients on my laptop, it doesnt let them send more than three messages between both of them. Can you tell me how to fix it?? thanks...
@NULL_exception
@NULL_exception 3 жыл бұрын
This is a very nice video! But is there any security issues opening port on our own website?
@joshcollister1114
@joshcollister1114 3 жыл бұрын
Great video man really informative! I was curious, how would you go about sending a message to a specific client connected to the server instead of broadcasting it to everyone?
@davidf628
@davidf628 2 жыл бұрын
I did this by adding a second parameter to the broadcast function in server.py called exclude: def broadcast(message, exclude=None): Then, I added an if statement in the for loop which prevents the message from being sent to any client that is specified as an exclusion: for client in clients: if client != exclude: client.send(message) Lastly, in the handle function I edited the line that broadcasts the message to all the clients by adding the current client as an exception: while True: try: message = client.recv(1024) broadcast(message, client) This prevents the message being sent back to the client that provided the message. Since the exclusion parameter in the broadcast message has a default of None, you don't have to supply exclusions for any other broadcast calls, you can just leave them as they are currently written
@arminjonker5928
@arminjonker5928 Жыл бұрын
@@davidf628 and how did you specify a client as an exclusion?
@user-rk9zx3lt8k
@user-rk9zx3lt8k 9 ай бұрын
very helpful video, one question, why encode with ascii, very confused
@yasiin1346
@yasiin1346 3 жыл бұрын
Hey, thank you for you work it helped me a lot. Could you add a unicast to it so like client to client instead like a groupchat ?
@mihaiioc.3809
@mihaiioc.3809 2 жыл бұрын
it wouod literally br the same thing but with a maximum of 2 connections, or, if you want to go into more advanced stuff where you can message every client individually i guess you could do that too, not much harder than what it's shown in the video, you can do it using what it's shown already
@gurashishanand3670
@gurashishanand3670 6 ай бұрын
great help. I just had a question though, is there a way that we can add text replacements in the client file ? for example, if i write "@me", it shows my nickname ?
@lonxwolx
@lonxwolx 3 жыл бұрын
binge watching your videos. cool stuffs!
@jett5385
@jett5385 3 жыл бұрын
writing and receiving messages happen at the same location. Imagine a user is trying to write somthing but she keeps getting messages from the others! this project needs two separate locations for receiving and writing messages. You are awesome man, keep the good work 👏
@inx1819
@inx1819 2 жыл бұрын
this is when you should start making an actual GUI for it, consoles aren't meant for this type of thing. look into tkinter or other python gui libraries
@jassebozic2504
@jassebozic2504 2 жыл бұрын
nice
@GuyA
@GuyA Жыл бұрын
Thank you for this video, helped a lot ! just one thing, the part of a user leaving the chat never works .. when was it supposed to get to this part ? thank you
@jacobodero9556
@jacobodero9556 3 жыл бұрын
👏👏👏
@bartkaron1935
@bartkaron1935 3 жыл бұрын
Hey there, I am trying to create a live chat using python which will allow me to connect to specific user instead of a global chat so everyone can read it. Is it possible with this one? So I run a server which broadcast everyone messages, but if I want to have 4 clients and two of them are connecting with each other and another 2 with each other. Not sure if you understand that but let me know please. I have been told to use WebSockets and avoid Socket. Not sure which one I should use to have a proper chat with PyQt5 UI, History of conversation, Search engine for the specific user nickname, etc. Also your tutorial is smashing! Thanks
@anakpinguin3942
@anakpinguin3942 Жыл бұрын
Wanna ask, how can we implement server control via the server terminal? Like basic control such as timeout, shutting down the server, blacklisting certain address, etc. Thanks
@ProjetatySandroCardoso
@ProjetatySandroCardoso 2 жыл бұрын
Hey buddy, you deserve a beer. Let me pix you some box to pay that! Best regards
@rohaanadvani3816
@rohaanadvani3816 2 жыл бұрын
Which library do we import to use the encode and decode functions?
@neetusingh2203
@neetusingh2203 3 жыл бұрын
First of all, I really like your vids and thanks for such a great content.My query : If the client is connected to a different wifi network (i.e, not on the wifi network on which the server is connected), will it connect to the server .In short, how can any client in the world connect to the server?
@NeuralNine
@NeuralNine 3 жыл бұрын
If the server is public sure. If it runs on your localhost not :)
@neetusingh2203
@neetusingh2203 3 жыл бұрын
@@NeuralNine Thanks a lot
@spodarman3823
@spodarman3823 3 жыл бұрын
You could enable port forwarding and forward the port which ur server is using Then just put the servers public ip address and the same port
@xJTPx
@xJTPx 3 жыл бұрын
@@spodarman3823 hi i did this and it does not work
@deathnetworkingtutorials7682
@deathnetworkingtutorials7682 2 жыл бұрын
@@xJTPx buy a VPS
@llofi_boy
@llofi_boy 2 жыл бұрын
Can you make a video on client to client communicstion where you can chat with any particular client and no other can see that
@cafelashowerezweb
@cafelashowerezweb 2 жыл бұрын
Does anyone know how to show " has left the chat"? By simply entering ctrl + c keys, the line does not appear. Or are there any other ways to get a client out of the chat?
@hello-my6ot
@hello-my6ot 3 жыл бұрын
And please make more parts
@MrRogue-uj6iz
@MrRogue-uj6iz 3 жыл бұрын
Edit: Got it working, so a different question. How do people join the chatroom over the same network?
@stormwolfplayz5931
@stormwolfplayz5931 3 жыл бұрын
if you mean from different devices, you need the local ip of the host device, then instead of 127.0.0.1 you put in the local ip of the host device
@preetamackermann3038
@preetamackermann3038 3 жыл бұрын
Which version of are you using in this video please let me know
@DrewComtois
@DrewComtois Жыл бұрын
I’d love to know how to add the kick or ban functions to this
@nofapobama
@nofapobama Жыл бұрын
i'm looking to implement conversational chat bots within this tcp chatroom. any idea how I would go about this?
@skandanarayan3059
@skandanarayan3059 3 жыл бұрын
Hi. I didn't understand in server. py why the comma was required after the client in the args in threading statement
@shchiranth6626
@shchiranth6626 4 жыл бұрын
Can we add audio exchange like discord
@davidregan792
@davidregan792 Жыл бұрын
Bro can you please give some solution? 1. A client can send a message either to a specific client. 2.The sender when it wants to broadcast a message, that is, to send a message to all of the clients. The format can be like "ALL*Message" 3.A simple encryption function could be like replacing each alphabet in the message with the next alphabet, i.e., if any client writes “abc” then it will be ‘bcd’ after encryption. I'm using your code. I'm starting learning python recently.
@Lithium59
@Lithium59 22 күн бұрын
Can this work on communicating off different networks? Because tcp apparently says it does that, so I'm just wondering.
@matthewclarke3635
@matthewclarke3635 3 жыл бұрын
this line is different in video( message = '{}: {}'.format(nickname, input('') ) to the one in your webcode i changed it to this and now works find
@nhupham1519
@nhupham1519 2 жыл бұрын
how can you keep your clients and nickname database list not reseting whenever theres another client join? Because what happened to me was it creates another list for new client, leading to each client has their own nickname list
@theanimeguy4556
@theanimeguy4556 Жыл бұрын
Sir please make a video of TCP chat room with ngrok plss
@bardbard3491
@bardbard3491 3 жыл бұрын
but when i try to connect with the server from another device its refuse to connet but if i connected with the wifi of the other device its work But if im in other city or another place that's can work
@SFblair
@SFblair Жыл бұрын
it wont let me run the sever it just runs studio code or do you have to use python editor
Simple Mail Client in Python
14:06
NeuralNine
Рет қаралды 48 М.
Python Sockets Simply Explained
39:33
NeuralNine
Рет қаралды 148 М.
Мама и дневник Зомби (часть 1)🧟 #shorts
00:47
ВИРУСНЫЕ ВИДЕО / Мусорка 😂
00:34
Светлый Voice
Рет қаралды 9 МЛН
Айттыңба - істе ! | Synyptas 3 | 7 серия
21:55
kak budto
Рет қаралды 1,4 МЛН
[실시간] 전철에서 찍힌 기생생물 감염 장면 | 기생수: 더 그레이
00:15
Netflix Korea 넷플릭스 코리아
Рет қаралды 38 МЛН
Advanced TCP Chat Room in Python
37:23
NeuralNine
Рет қаралды 51 М.
Coding a Web Server in 25 Lines - Computerphile
17:49
Computerphile
Рет қаралды 313 М.
Google Data Center 360° Tour
8:29
Google Cloud Tech
Рет қаралды 5 МЛН
Coding Encrypted Chat in Python
20:33
NeuralNine
Рет қаралды 42 М.
Simple GUI Chat in Python
35:56
NeuralNine
Рет қаралды 171 М.
Распаковка айфона под водой!💦(🎥: @saken_kagarov on IG)
0:20
Взрывная История
Рет қаралды 10 МЛН
С Какой Высоты Разобьётся NOKIA3310 ?!😳
0:43
Эволюция телефонов!
0:30
ТРЕНДИ ШОРТС
Рет қаралды 2,9 МЛН
Broken Flex Repair #technology #mobilerepair
0:55
ideal institute aligarh
Рет қаралды 16 МЛН