Socket Chatroom client - Creating chat application with sockets in Python

  Рет қаралды 131,540

sentdex

sentdex

Күн бұрын

Пікірлер: 235
@ali_adeeb
@ali_adeeb 5 жыл бұрын
OH GOD me and my friend were looking a perfect tutorial for this like last week and you released these!!! You'll probably go down as the most loved programmer!!
@sentdex
@sentdex 5 жыл бұрын
🥰
@ali_adeeb
@ali_adeeb 5 жыл бұрын
@@sentdex I don't even know what that means but I dont care thanks for replying!!
@sreetamakundu1478
@sreetamakundu1478 4 жыл бұрын
@@ali_adeeb hi
@DeepakKumar-os4bl
@DeepakKumar-os4bl 5 жыл бұрын
Just for info. If anybody has any difficulty in understanding the code in the video, head over to the text version of the tutorial. It has been explained beautifully. Thanks Harrison :-)
@calebmwaura8631
@calebmwaura8631 5 жыл бұрын
where is the text version buddy??
@kanknw
@kanknw 5 жыл бұрын
@@calebmwaura8631 it's in the description
@calebmwaura8631
@calebmwaura8631 5 жыл бұрын
@@kanknw please send me a link...kindly..
@anirbandey303
@anirbandey303 5 жыл бұрын
I've seen a lot of tutorial videos of many people on many things but your way of explanation is the best! It's clear and simple, I love it.
@sentdex
@sentdex 5 жыл бұрын
Great to hear!
@nikodemus7900
@nikodemus7900 5 жыл бұрын
The moment when you are sure that you have seen all of his mugs... It is an illusion
@karanrandhawa1376
@karanrandhawa1376 5 жыл бұрын
you literally have a video for everything. I LOVE IT
@MyPlaylist-xq8en
@MyPlaylist-xq8en 5 жыл бұрын
I've been waiting for this.....Great Tutorial and Awesome Video!
@georgemavimbela
@georgemavimbela 5 жыл бұрын
this is awesome..thanks I will use this when getting serious on my Python coding lessons
@KushChoudhary
@KushChoudhary 5 жыл бұрын
are u serious now?
@KushChoudhary
@KushChoudhary 5 жыл бұрын
again am here, worried for u. after 1 month
@KushChoudhary
@KushChoudhary 4 жыл бұрын
Hey Friend, I hope u are serious now edit: After 1 month
@dazewaker262
@dazewaker262 Жыл бұрын
Are you serious now ?
@mt.erebus3370
@mt.erebus3370 3 жыл бұрын
Hey sentdex buddy ol' pal, are you considering continuing this tutorial? found it super fun and learned a ton. would love to see gui implementation!
@arozoid
@arozoid 2 жыл бұрын
Check out the Kivy tutorial for GUI implementation.
@wathekghenimi9133
@wathekghenimi9133 5 жыл бұрын
you're a legend thank you so much this is helps me in my project
@vomomediaonline
@vomomediaonline 3 жыл бұрын
I haven’t done this but I am very sure if I do, it’s gonna work ! This is so amazing! It has everything I want, I want to say a very big thank you 🙏🙂 keep it up bro
@dmytroohorodnik3562
@dmytroohorodnik3562 5 жыл бұрын
Hell yeah..! Really great tutorial. Exactly what I needed. Wish you good fortune :-)
@marv-n6m
@marv-n6m 5 жыл бұрын
In your written code for the client there is a typo in the last exception: except Exception as e: # Any other exception - something happened, exit print('Reading error: '.format(str(e))) sys.exit() you're formating but there are no {} inside the string. Love that tutorial, was a lot of fun to build that. Have a good one!
@copanomo1
@copanomo1 3 жыл бұрын
Could you please explain more about blocking vs non-blocking recv() and how to implement command/response protocols with timeouts?
@marinaurrey5246
@marinaurrey5246 5 жыл бұрын
Thank you! Very interesting experience. You do good tutorials)
@sentdex
@sentdex 5 жыл бұрын
Happy to share!
@frbuccoliero
@frbuccoliero 5 жыл бұрын
"Cool!" Part 2 the revenge of the cold
@copanomo1
@copanomo1 3 жыл бұрын
Excellent video series! Thank you!
@bitcointrader8586
@bitcointrader8586 5 жыл бұрын
Best python youtuber hands down
@Snv_23
@Snv_23 5 жыл бұрын
always love your incredible tea cups)))
@matbaker8294
@matbaker8294 5 жыл бұрын
Great tutorial. Has sent me in the right direction.
@bn_ln
@bn_ln 2 жыл бұрын
great series - many thanks
@lbxmega6574
@lbxmega6574 4 жыл бұрын
How can I connect to the server from another computer? I have tried multiple IP’s and received various errors such as “no connect route” and “host error”. Anyway I can connect a remote device to my server?
@ScottUlmer
@ScottUlmer 5 жыл бұрын
+1 on seeing you do this with Qt5 :)
@matsinorge
@matsinorge 4 жыл бұрын
Thank you for this tutorial!! ❤️
@Zephyr-tg9hu
@Zephyr-tg9hu 3 жыл бұрын
Awesome tutorial, thanks.
@johncarcher
@johncarcher 2 жыл бұрын
Great video, only 1 issue with the code. How could I make it so that it constantly refreshes so I don't have to send a message in order to receive new ones if that makes sense. Basically if I send a message then person 2 sends a message, I would have to send a message to receive the message that they sent me.
@pi_r_mlm
@pi_r_mlm 4 жыл бұрын
20:46 : You can create threads to receive and send at the same time
@lakshaygarg7311
@lakshaygarg7311 4 жыл бұрын
can use share tutorial for this
@ruleofthree1733
@ruleofthree1733 5 жыл бұрын
Would be cool if you did a video expanding on this with regards to the server looking for keywords, and then executing a bit of script from a program you've written. Like !roll sent from a user randoms a d6. Or incorperating a little 'mini game' involving another .py file.
@alpstinger5083
@alpstinger5083 4 жыл бұрын
Thanks man for this awesome tutorial!!!! From where do you learn all this stuff? Because you teach everything so perfectly!
@anchalmallick3335
@anchalmallick3335 4 жыл бұрын
Thankyou! You are my inspiration :)
@Bvic3
@Bvic3 Жыл бұрын
In case you don't like the weird way to convert with f-strings/strip to manage bytes, here is another version: bytes_header = int.to_bytes(len(bytes_message), HEADER_LENTH, "big") int_header = int.from_bytes(bytes_header, "big") And to convert utf8-string to bytes: bytes_data = bytes(data, "utf-8") utf8_data = bytes_data.decode("utf-8")
@rydxz6149
@rydxz6149 2 жыл бұрын
How to make the messages pop up instant?
@everton.colombo
@everton.colombo 4 жыл бұрын
For those of you interested, I made a GUI version of this using tkinter that also constantly checks for new messages. Here, have a look: github.com/Everton-Colombo/Socket-Chatroom
@sentdex
@sentdex 4 жыл бұрын
Please provide attribution for the socket bits
@bubbachubs8224
@bubbachubs8224 4 жыл бұрын
How do I make this actually work across multiple computers, so that I can actually talk to other people and not myself
@AdiParamartha
@AdiParamartha 5 жыл бұрын
thank you, very helpfull , hopefully i could implement it to iot devices soon
@AMOs-sy8vl
@AMOs-sy8vl 5 жыл бұрын
Still you are working with us thank you
@nuklearboysymbiote
@nuklearboysymbiote 5 жыл бұрын
in your text-based tutorial you didn't import sys, might want to fix that
@icicles0
@icicles0 3 жыл бұрын
help at 17:00 I got an error for server.py for line 27 :"IndentationError: Unindent does not match any outer indentation level"
@ishaanverma1268
@ishaanverma1268 5 жыл бұрын
Ayyy he switched to sublime
@pra8eek
@pra8eek 5 жыл бұрын
Great tutorial! Is the GUI video uploaded yet?
@judeleon8485
@judeleon8485 4 жыл бұрын
Great tutorial. Where can find the server and client code scripts written in this tutorial?
@luvkhajuria207
@luvkhajuria207 4 жыл бұрын
for handling client inputs and printing other inputs of other clients at the same time for this, you just have to make input non-blocking. this may help I guess. r_list , _,exe_list = select.select([sys.stdin,client_socket],[],[sys.stdin,client_socket]) for read in r_list: if read == client_socket: msg = client_socket.recv() else: out_msg = sys.stdin.readline().decode('utf8') client_socket.send(out_msg) btw by far best tutorial on sockets and one of the best channel on youtube
@mihirbhudia4064
@mihirbhudia4064 4 жыл бұрын
I am very confused atm. I have followed your exact code, even copy and pasted the code from your website, but I do not seem to get the "new client connection" message. Does anyone have any possible reason for this that there could be?
@ScottUlmer
@ScottUlmer 5 жыл бұрын
Hey I found a way to attach it into a UI. The biggest "issue" is that I had to break your While True and instead had it look for new messages every 1 second. While there might be some lag (literally up to a second), I find this more than useful to people who would be following these tutorials. Just so you know I simply took your code and modified it to work with a .ui file. Using a .ui with Qt Designer is very user-friendly. If you are interested in what I made let me know.
@wesleywithrow3524
@wesleywithrow3524 5 жыл бұрын
He has a tutorial on how to create a UI for this using Kivy.
@Froggles_
@Froggles_ 4 жыл бұрын
Can you please write the code into the comment section or the description because I’m really struggling to keep up on everything you are doing thank you:)
@CRsquared64
@CRsquared64 4 жыл бұрын
the server doesn’t show connections on when a message is sent? please help.
@liuyang9483
@liuyang9483 4 жыл бұрын
can we make two threads that one is for sending and the other is for receiving so that you dont have to press enter to check any incoming msg. It just shows up.
@HT79
@HT79 4 жыл бұрын
yep, that's one way to do it
@MstrangerGaming
@MstrangerGaming 8 ай бұрын
i know this is an old video but the logic still works, now the question is , if i want to make this public (connection with different network) then how the connection will work
@wompytompylompyshompy
@wompytompylompyshompy 4 жыл бұрын
I love your videos and actually highly appreciate it if you would teach us (I'm a total python noob just following the steps of the tutorial) how to put this in a GUI.
@jake2663
@jake2663 4 жыл бұрын
The tkinter library might be a good place to start for simplicity but QT is better
@swiftlyexplained703
@swiftlyexplained703 4 жыл бұрын
It worked! Thank you! :)
@MustafaAktasVEVO
@MustafaAktasVEVO 5 жыл бұрын
Hello sentdex, In this application we r only able to send messages, but what if want to send an `image` to the server?
@MustafaAktasVEVO
@MustafaAktasVEVO 5 жыл бұрын
Guys I am done with this problem. If u wonder how to send an image to server/client in python, let me know.
@ilyaprieur8254
@ilyaprieur8254 5 жыл бұрын
@@MustafaAktasVEVO me.
@Die__Ene
@Die__Ene 4 жыл бұрын
I havn't tried it myself to see if it works but you could use part 3 in this tutorial to pickle an image and send it. The receiver can then unpickle and write the image data to a .png file and that should get you the image. I guess you could also just send the raw binary data directly and write that to a .png. What solution did you come up with?
@samdose4672
@samdose4672 5 жыл бұрын
Couldn't you just use threading to update the incoming messages without being blocked by the input?
@xCleverton
@xCleverton 5 жыл бұрын
would like to know how this could be done
@devallazzydevs8544
@devallazzydevs8544 5 жыл бұрын
Its a great video...can you tell me how to run python file from the local server to client server? or is there any other ways to run python file?
@Mzkysti
@Mzkysti 5 жыл бұрын
Great Socket tutorial, thanks. It kept me wondering is it possible to run these in Sublime Text?
@rhulanimogotsi6869
@rhulanimogotsi6869 3 жыл бұрын
How do I keep the socket open in the background to accept any incoming messages, even if the app isn’t open
@caseycruz7959
@caseycruz7959 2 жыл бұрын
Is there a way that the client can pick who they want to send a message to if there are more than two clients?
@eddied.3426
@eddied.3426 4 жыл бұрын
This is great. Could you make a tutorial on how to make a video chat program? Info on the web seems scarce on this point. Also, how do you connect server to clients over the internet?
@johncarcher
@johncarcher 2 жыл бұрын
To get the server to connect clients over the internet, I'd say set the server to the IP of your internet router then get the clients to set their IPs to the routers then the Server will listne to the routers port and the clients will connect to the routers port.
@sanasm3359
@sanasm3359 4 жыл бұрын
u actually save me ! that is my project for university but in which video u have worked on UI?
@hichambenhammouda7368
@hichambenhammouda7368 4 жыл бұрын
really great tutorial, I actually took your idea and used a Tkinter GUI for it. I have one question though , if say like I want the server to make a list of all connected clients and broadcast that list so it can be shown in the client GUI and ofcours it would be continuously update.. how can I do that ?
@SurferBoi561
@SurferBoi561 3 жыл бұрын
Help line 41, in user = receive_message(client_socket) NameError: name 'receive_message' is not defined
@samuelgriffin1955
@samuelgriffin1955 5 жыл бұрын
Thanks, really helpful
@richyuh
@richyuh 5 жыл бұрын
How is the client code exiting out of the while True: # receive things and not stuck in an infinite loop? Thank you for the tutorial
@adityapandey1176
@adityapandey1176 5 жыл бұрын
Hello. I wanna ask you something please. I am an intermediate in python programming language and I learned all that from youtube. So I now wanna learn Artificial intelligence. But the point is that I am not able to get proper video lectures and procedures to install tensorflow and all that. I have a laptop with intel atom processor and 2 gb ram with no grapgics card and windows 10. So, now if I can install tensorflow then how to install it and also where I can get free video lectures plzz suppprt me and reply please
@mateuszkolpa
@mateuszkolpa 5 жыл бұрын
pythonprogramming.net/introduction-deep-learning-python-tensorflow-keras/ But I wouldn't start with TensorFlow. Probably better idea to start playing Machine Learning and stuff like that is for example: pythonprogramming.net/image-recognition-python/ Or something little more fun to play with: pythonprogramming.net/loading-images-python-opencv-tutorial/ this one is more picture and video oriented, but its' still fun :)
@gmqwerty2468
@gmqwerty2468 4 жыл бұрын
2gb ram? u sure u wanna do this?
@Strawberry-oz1qu
@Strawberry-oz1qu 2 жыл бұрын
Please continue this series, I tried both Threading and Multiprocessing but the message from the other side doesn't come simultaneously. Please make a video and guide us.
@shreyashdeshmukh5790
@shreyashdeshmukh5790 3 жыл бұрын
Does this work on public or just localhost??
@riaindaly9026
@riaindaly9026 2 жыл бұрын
why do i have to keep hitting enter to see new messages?
@hx9d674
@hx9d674 5 жыл бұрын
So there is or isn't way to make chat automatically updated when new message is recived?
@felix.taken0
@felix.taken0 2 жыл бұрын
Im getting an error: Reading error [WinError 10054] An existing connection was forcibly closed by the remote host
@2wen98
@2wen98 2 жыл бұрын
you are trying to run server twice
@jaffryjaman4951
@jaffryjaman4951 5 жыл бұрын
Hello , do you have any plans to make a series on computational fluid dynamics ? The thing is that i am familiar with python , but there are limited tutorials on how to use the python modules used for computational fluid dynamics. It would be very useful if you made a tutorial series on cfd for the aeronautical engineering communities . Thanks
@menandmice
@menandmice 5 жыл бұрын
Computational fluid dynamics is an extremely theoretical area of science. A sort of rocket science. To make tutorials about that and Python would demand lots of time and expertise. Many, many months.
@jaffryjaman4951
@jaffryjaman4951 5 жыл бұрын
@@menandmice thanks for letting me know
@bcddd214
@bcddd214 4 жыл бұрын
I totally used/sponged this.
@no5x937
@no5x937 5 жыл бұрын
Excellent Series on Python 3 Sockets. I got it to work with the Server in one terminal and one Client in another terminal. When I add a 2nd Client, the Server recognizes it and also receives messages. But the two Clients don't recognize each other and they eventually exit from a General Error invalid literal for int() with base 10: 'Hello Serv' Any ideas?
@ravindramohith7082
@ravindramohith7082 2 жыл бұрын
yeah same error any soln for this prob?
@yorozuya6115
@yorozuya6115 5 жыл бұрын
Nice tutorial, can I send message from server to clients? without block?
@ottop1377
@ottop1377 4 жыл бұрын
how do i make this work accross multiple computers? i've tried using a hamachi server but it just doesnt connect. even my own ipv4 address doesnt work, it says the ip is not valid in its context. can someone please help?
@Jonas-odt
@Jonas-odt 4 жыл бұрын
Greate video! Question will this code be able to control the clients pc? like run commands in the command line and such? Thanks!
@ottop1377
@ottop1377 4 жыл бұрын
no.
@ATXpert
@ATXpert 5 жыл бұрын
if i want to make the application public to download, and a private chat(person to person) how do i know which ports are open for use in the clients system, and also i suppose i need to make a server that will connect between two clients, by username. main question is how do i know which ports are ready to use
@unix.geektarektalaat1631
@unix.geektarektalaat1631 5 жыл бұрын
Hey, I have a question, how do you interact with each thread ? for instance, if you want to send data from server to a specific client using whatever thread id or anything else. So if server got 3 clients connected, now you want the server to send data to specific client by using thread id or thread ident number or anything. I tried and failed. Can you guide me ?
@shinydewott
@shinydewott 4 жыл бұрын
I know this is an old video, but I've been trying to host a game I've been working online to play with a friend. I have managed to get the sockets to work on my local internet but I can't find any explanation on how to do it online.
@lolj2094
@lolj2094 5 жыл бұрын
great stuff as always man
@rahulmundlamuri7999
@rahulmundlamuri7999 5 жыл бұрын
I am getting an error after sending the first message (General error name 'username_length' is not defined)
@tanmays9653
@tanmays9653 4 жыл бұрын
did u get the answer of this error
@gamhcrew556
@gamhcrew556 3 жыл бұрын
will your program work if the client and server programs are running from different devices?
@santhoshxd
@santhoshxd 5 жыл бұрын
bro when are you going to do the GUI? btw Very nice video brooo...helped a lot!!!
@sentdex
@sentdex 5 жыл бұрын
Already did, with Kivy, here: pythonprogramming.net/introduction-kivy-application-python-tutorial/
@imagineexistance4538
@imagineexistance4538 5 жыл бұрын
For the message receiving without input try _thread or if you don’t have it as a module look at threading(I use pythonista and have _thread but pythonista has different things).and try and make the output and input functions because the module runs two functions and tuples of them(if no input use (,)), The module will continuously run both simotaniously, it is not perfect but works good on my projects, try it out with a copy, it may work or completely break the code
@vachaarraniry
@vachaarraniry 4 жыл бұрын
what do i do i got this error General error int() argument must be a string, a bytes-like object or a number, not 'builtin_function_or_method'
@laymanclasher1061
@laymanclasher1061 5 жыл бұрын
i followed the whole video , but my server is not responding, what will be the possible error?????
@DestinyCreatesEntertainment
@DestinyCreatesEntertainment 5 жыл бұрын
on the website you forgot to import sys. also, unused import statement select on client
@csmh
@csmh 2 жыл бұрын
Brother , is this work on wide area network ( WAN ) .....
@JPR137
@JPR137 5 жыл бұрын
yOU doing this from memory omg
@pritkalariya3976
@pritkalariya3976 3 жыл бұрын
Can anyone share the link to the GUI tutorial for this chat application.
@YashovardhanJha
@YashovardhanJha 5 жыл бұрын
which ip have you put in the client and server file when you are connecting with other machines on other networks
@jonathanmarx752
@jonathanmarx752 4 жыл бұрын
HI, I tried running it from 2 different computers and it didn't work. how should I change it so it works between different computers?
@sanjaytp9410
@sanjaytp9410 5 жыл бұрын
Hey, did the vid for creating the GUI part of a chat room get posted on youtube..?
@KushChoudhary
@KushChoudhary 5 жыл бұрын
i will be making that with source code sooner
@hairandbeautycenter7216
@hairandbeautycenter7216 2 жыл бұрын
There is still that one error... After replacing AND with OR.. Error: Reding error.... A non-blocking socket operation could not be completed... Plzz Help me... Thanks in advance...
@voidling2496
@voidling2496 4 жыл бұрын
i put a wait for a key to get pressed before the message thing so you have to press a key to send a message but it updates automaticly if you dont type noting os dependent
@happymonkey1703
@happymonkey1703 5 жыл бұрын
Hey um i have a problem, my client is having trouble connecting with the server, well the server is not printing out the part where it said accepted new connection... . This video is great help!
@ottoyang
@ottoyang 4 жыл бұрын
Try turning off your antivirus, That also happened to me
@zdrasbuytye
@zdrasbuytye 4 жыл бұрын
can I run this codes on ubuntu shell ? and what IDE are you using ?
@furiateds
@furiateds 3 жыл бұрын
when opening cmd to open my server, it says “can’t find ‘__main__’ module” someone help
@Fuzti13
@Fuzti13 3 жыл бұрын
Could someone explain to me what the ":
@stefanlin5086
@stefanlin5086 3 жыл бұрын
wouldnt it be better to easier to use threading instead
@nishtha7597
@nishtha7597 4 жыл бұрын
Nyc tutorial..can you please make a tutorial how to connect it with face recognition for more security. I need to do this in my project but can't find any tutorial for that.
@tylerboucher2108
@tylerboucher2108 4 жыл бұрын
it wont let me launch the server or the client from cmd help plzzzzz
@ZemZem
@ZemZem 4 жыл бұрын
Sentdex, is it possible to make a socket with bluetooth on PC (Using AF_BLUETOOTH) ? because I always get an error saying that there is nothing called AF_BLUETOOTH, and when I made a search I found that some people claimed that bluetooth socket with python is not supported in Windows ...
Python Sockets Simply Explained
39:33
NeuralNine
Рет қаралды 169 М.
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 30 МЛН
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
Simple TCP Chat Room in Python
25:39
NeuralNine
Рет қаралды 232 М.
Python Socket Programming Tutorial
49:43
Tech With Tim
Рет қаралды 1 МЛН
Pyautogui image detection
14:41
CodersLegacy
Рет қаралды 35 М.
Socket Programming Using Python
17:07
Telusko
Рет қаралды 308 М.
Socket.IO with Python and JavaScript
1:32:00
Miguel Grinberg
Рет қаралды 40 М.
Multithreaded Client Server in Python || Socket Programming in Python
21:45
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН