Socket Chatroom server - Creating chat application with sockets in Python

  Рет қаралды 284,887

sentdex

sentdex

Күн бұрын

Пікірлер: 282
@komroncodes
@komroncodes 5 жыл бұрын
Wow, these tutorials are timely af
@HK-sw3vi
@HK-sw3vi 4 жыл бұрын
so are the cups he's using to sip that mysterious drink
@kindersmith8407
@kindersmith8407 4 жыл бұрын
*do you even need to ask of what I wana say?*
@stratisdermanoutsos9113
@stratisdermanoutsos9113 5 жыл бұрын
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
@sentdex
@sentdex 5 жыл бұрын
Haha great! Next part tomorrow!
@Jonasgeorg
@Jonasgeorg 3 ай бұрын
i really fucking love your tutorials, you have this classy-funny engineer vibe, it just is fun to watch your stuff man, keep goin
@danm2092
@danm2092 4 жыл бұрын
This taught me a lot about how traffic is handled by servers, thanks for the great video!
@slavoie
@slavoie 5 жыл бұрын
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 :).
@sentdex
@sentdex 5 жыл бұрын
We have a few mug racks that hang on the wall to help manage them
@Aragubas
@Aragubas 4 жыл бұрын
i made an complete webchat app using this tutorial as a base, thank you!
@shiuido359
@shiuido359 4 жыл бұрын
When the parser has an error, there is a little arrow ^ which will point out the error. In your error, you can see it is pointing directly to the ". In this case it would have saved you a few minutes, in the future it might have saved you a few hours :)
@MacintoshFanTechnology
@MacintoshFanTechnology 4 жыл бұрын
7:30 Should be "return False". Edit: Glad you fixed it at 9:55
@kindersmith8407
@kindersmith8407 4 жыл бұрын
nothing matters if I can't find part 2 ):
@zackmanz1
@zackmanz1 4 жыл бұрын
Killer content, killer mugs.
@nabeeghahmed8530
@nabeeghahmed8530 5 жыл бұрын
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
@sentdex
@sentdex 5 жыл бұрын
Hah, yes, it's been a fun ride so far :) Thanks for hanging out with us for so long :O
@sentdex
@sentdex 5 жыл бұрын
Some of it was, but I'm assuming hes talking about the early gta days, more like 2 yrs ago
@moniquemarinslp
@moniquemarinslp 5 жыл бұрын
Great series! Have been following you for a while now and you keep posting good content!
@whammynator8112
@whammynator8112 4 жыл бұрын
And as always: "... I forgot what Python version I'm using."
@nubcops220
@nubcops220 4 жыл бұрын
python --version in the command prompt lol
@godfather7339
@godfather7339 3 жыл бұрын
@@nubcops220 omg thanku so much, none of us knew that.
@vaibhavsingh1049
@vaibhavsingh1049 5 жыл бұрын
Hey Sentdex, I've following your channel for a long time now and I've grown accustomed to your style of teaching. I just have a little suggestion to you that I think would make your videos more awesome. Before writing any line of code that might not be obvious for the viewers to imagine and see why it's used, please explain a little bit about it or what the end result would be, sometimes it's hard for us to figure out and try to formulate as we what the end result might be. Like at 3:10 you explained why we used setsockopt () but at 14:20 and 17:30 it started to get cluttered up very fast and I got lost. Just a little input from my side. Thank you for your tutorials.
@sentdex
@sentdex 5 жыл бұрын
Thank you for the feedback!
@scoopedcontent
@scoopedcontent 3 жыл бұрын
You're coffee mug is DOPE!
@henrique-sousadev
@henrique-sousadev 3 жыл бұрын
I love your mugs LOL
@dnetne5508
@dnetne5508 4 жыл бұрын
First I disliked because I thought you were not being clear enough.. but then I also realized the reason behind that being is that you are on another level compared to myself.. Though I will probably connect the dots and have a well written code.. so *Thumbs up* xD Please do not hate me - I liked every other video I watched from you hahaha, great tutorials! *EDIT: Oh boy was I wrong - I just went to the 1st link you provided in the description :'D*
@kindersmith8407
@kindersmith8407 4 жыл бұрын
just look. its just me frantically looking for part 2 since it was never mentioned in the damn desc
@enricogolfen
@enricogolfen 3 жыл бұрын
I think by now that you know it since its been 4 months but if you search Sockets tutorial with python 3 you will find the parts 1-3.
@bloodgain
@bloodgain 5 жыл бұрын
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.
5 жыл бұрын
None is a value actually of type (class) NoneType, as False is a value of type (class) bool. Botht are same different from dict. Both None and False can be handles in a way you proposed, so "if not message". Byt it is more Pythonic to check if is not None or if is not False. In both case if it will be None or empty dict and you check "if not message" Python actually has to type that to boolean first, what is not really a Pythonic way. You can use None instead here, but then if you want to check it in a pythonic way, you should use "if message is not None". Then second part - you have "if" statement and you should use it whenever possible. It is true that sometimes it is easier to use "try ... except" but in cace of that simple "if" statement as here, why do you want to use exceptions? It needs more code and runs whole exception handling stuff when you can simply do an "if" check. There's no really a reason.
@VISHALSHARMA-qb7ue
@VISHALSHARMA-qb7ue 5 жыл бұрын
hey sentdex I love your tutorials You are awesome
@jsceo
@jsceo 5 жыл бұрын
definitely the most adorable mug
@kindersmith8407
@kindersmith8407 4 жыл бұрын
the mug? there was a mug? I was too distracted trying to find the riddle of part 2 to the thing I want to code
@josephstalin2647
@josephstalin2647 5 жыл бұрын
my friends: how do you make that?? "me last 2 hours because stoping video" idk how but it works
@colleagueriley8451
@colleagueriley8451 4 жыл бұрын
Father Stalin...is that you?
@josephstalin2647
@josephstalin2647 4 жыл бұрын
@@colleagueriley8451 zdrav
@nituplays_3875
@nituplays_3875 4 жыл бұрын
Papa stalin how is ussr
@nickjonas8257
@nickjonas8257 4 жыл бұрын
@@nituplays_3875 говно ссср это..
@kindersmith8407
@kindersmith8407 4 жыл бұрын
DID YOU FIND PART 2? OR AM I THE ONLY ONE CONFUSED ABOUT WHY IT LEFT ME ON A CLIFFHANGER
@blatogh1277
@blatogh1277 4 жыл бұрын
nice! Thanks for the tutorial. As a novice, this tutorial is easy to understand.
@BuTTerJaFFaS
@BuTTerJaFFaS 4 жыл бұрын
shut up, novice. gay.
@Alexarr
@Alexarr 4 жыл бұрын
Hi, awesome tutorial !
@BuTTerJaFFaS
@BuTTerJaFFaS 4 жыл бұрын
shut up, gay.
@ithaca2076
@ithaca2076 3 жыл бұрын
@@BuTTerJaFFaS ok gay
@jaxhorn-lq6uv
@jaxhorn-lq6uv Ай бұрын
14:50 "It'll be fine." story of all coding ever
@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 string to bytes: bytes_data = bytes(data, "utf-8") utf8_data = bytes_data.decode("utf-8")
@thegamejasper6275
@thegamejasper6275 5 жыл бұрын
I like your mugs :)
@BuTTerJaFFaS
@BuTTerJaFFaS 4 жыл бұрын
i dont like ur mugs, gay.
@Anirbansinha24
@Anirbansinha24 5 жыл бұрын
Just joking bro, i really enjoyed the video and really i got inspired by this
@HK-sw3vi
@HK-sw3vi 4 жыл бұрын
i thought your name was Airbnb sinha
@Anirbansinha24
@Anirbansinha24 4 жыл бұрын
@@HK-sw3vi i thought your name is dickhead HK
@HK-sw3vi
@HK-sw3vi 4 жыл бұрын
@@Anirbansinha24 interesting
@Anirbansinha24
@Anirbansinha24 4 жыл бұрын
@@HK-sw3vi suggest me some songs bro
@rishabhshah3097
@rishabhshah3097 4 жыл бұрын
I am a beginner is python and half of the stuff just went over my head
@etc_cubing5717
@etc_cubing5717 4 жыл бұрын
lol same actually, more than half
@HK-sw3vi
@HK-sw3vi 4 жыл бұрын
that's why you start from the cardinals
@BuTTerJaFFaS
@BuTTerJaFFaS 4 жыл бұрын
ur dumb, and gay. bye.
@fredpourlesintimes
@fredpourlesintimes 4 жыл бұрын
The same for me.
@m.latifmoh1895
@m.latifmoh1895 5 жыл бұрын
oooo wow you are just superb!! its my fav tutorials :) hope you do full course tutorials for python! thanks !!
@kindersmith8407
@kindersmith8407 4 жыл бұрын
*I hope theres' a full course on this because its from 2019 and I can not find part 2. Thanks for getting my hopes up*
@ThatOnlyFan
@ThatOnlyFan 5 жыл бұрын
Yaaaaay! You're back!
@pythonocean7879
@pythonocean7879 5 жыл бұрын
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 :D
@kindersmith8407
@kindersmith8407 4 жыл бұрын
still looking for part 2, I spent a lot of time on this....
@stephenjames5745
@stephenjames5745 4 жыл бұрын
Excellent video! Thank you
@kindersmith8407
@kindersmith8407 4 жыл бұрын
if I could find part 2, I wouldent be mad right now but here we are
@TobiasLundgren1
@TobiasLundgren1 5 жыл бұрын
Thank you for an awesome tutorial!
@kindersmith8407
@kindersmith8407 4 жыл бұрын
WHERES PART 2 AAAAAAAAAAAAAA
@Shingorani
@Shingorani 5 жыл бұрын
quick question, how do we make it so that when a user sends a message, everyone's chat screen is automatically updated with the most recent messages? Currently, it only updates if the user sends a message or clicks enter.
@blatogh1277
@blatogh1277 4 жыл бұрын
This problem is coming from client.py. The code needs you to type your words then to step into the receiving procedure. The solution can be splitting the receiving and input into two separate Python files ---the message receiver and the message sender. The message receiver, based on the code, can be also the client that connects to the server but act like a listener and no need for a response.
@YH-ho8rv
@YH-ho8rv 4 жыл бұрын
jh
@Lifeport-z
@Lifeport-z 3 жыл бұрын
server.py", line 9, in server_socket.setsockopt(socket.SOL_SOCKET, socket.SO__REUSEADDR, 1) AttributeError: module 'socket' has no attribute 'SO__REUSEADDR' Im having problems here i don't know why but this doesn't work i think its cause im running version 3.9.1 or im just blind and messed something up.
@vanditha07
@vanditha07 3 жыл бұрын
10:04 good collection!
@geeli_puppy_.
@geeli_puppy_. 4 жыл бұрын
No one sentdex having a computer which can play cyberpunk but still using sublime text in it
@geeli_puppy_.
@geeli_puppy_. 3 жыл бұрын
@Alfie Pycharm gives suggestions fast compare to sublime text
@jsobev8036
@jsobev8036 2 жыл бұрын
I like your cup 5:00 🤣
@felix.taken0
@felix.taken0 2 жыл бұрын
Im have an error "A non-blocking socket operation could not be completed immediately", how to fix this?
@PixelMuse
@PixelMuse 3 жыл бұрын
ok so this might be a dumb question but is there a way to allow people to connect from another device that's not on the same network? mine is keeping it stuck to lan...
@whammynator8112
@whammynator8112 4 жыл бұрын
21:41 do the double quotes (") result in an error because we are already using them for the actual String?
@MrNeuroMind
@MrNeuroMind 4 жыл бұрын
yes, then interpreter thinks that the string ends when he meets second " sign.
@sachinreddy7811
@sachinreddy7811 5 жыл бұрын
OMG!!!! it's Edward Snowden making KZbin videos. Bro....How are you on KZbin? Big Fan..
@y.z.6517
@y.z.6517 4 жыл бұрын
IS HE?!
@BuTTerJaFFaS
@BuTTerJaFFaS 4 жыл бұрын
no hes not, shut up ur dumb.
@todorpopov8613
@todorpopov8613 5 жыл бұрын
Woow those are quite a few sockets
@venom_ftw9316
@venom_ftw9316 5 жыл бұрын
You, are, amaziinnnng thank you soo much😭😭😭
@kindersmith8407
@kindersmith8407 4 жыл бұрын
you look like you know! wheres part 2?!?! TELL MEEEEE
@venom_ftw9316
@venom_ftw9316 4 жыл бұрын
@@kindersmith8407 🥺🥺🥺 don't bully me please...
@kindersmith8407
@kindersmith8407 4 жыл бұрын
@@venom_ftw9316 *wheeze* okay okay XD
@samirthapa792
@samirthapa792 5 жыл бұрын
Really cool video
@sentdex
@sentdex 5 жыл бұрын
Thanks!
@dnetne5508
@dnetne5508 4 жыл бұрын
On line 36 - shouldn't it be *!=* instead of *==* ? Because otherwise I can not really understand how that makes sense - even after reading your comments from your 1st link. The comment says # If notified socket is a server socket - new connection, accept it
@yuemar779
@yuemar779 4 жыл бұрын
when ı was send the client to the another pc it doesnt work. what should ı do
@jakubkohak7992
@jakubkohak7992 4 жыл бұрын
what? Maybe some explanation could help.
@yuemar779
@yuemar779 4 жыл бұрын
@@jakubkohak7992 hello thx for your interest my problem is the client is only working on my pc when ı send client to the another pc clients are not connecting same server
@theelectronicsguy4218
@theelectronicsguy4218 4 жыл бұрын
​@@yuemar779 Hi! Could you please let me know how could we implement it in UDP?Thanks!
@stenhealey7320
@stenhealey7320 3 жыл бұрын
Probably a fairly abstract question but why does pickle appear to use utf-16 encoding?
@danieldinh9911
@danieldinh9911 3 жыл бұрын
i'm trying to list the users that are connected to the server. I assume we do that on the server side? Also I want to do some private messaging. Can you give me some tips on how to implement these? I can't find a good source online.
@zephyrstudios4600
@zephyrstudios4600 3 жыл бұрын
Funny, I just chose making a chat app as my Computing SAC task :O
@zenchen围棋1712
@zenchen围棋1712 3 жыл бұрын
print(f"Accepted new connection from {client_address[0]}:{client_address[1] username:{user['data'].decode('utf-8')}") invalid syntax not sure what is missing.@sentdex
@preetisaroj6885
@preetisaroj6885 4 жыл бұрын
while giving a command python server1.py in cmd my cursor is just blinking ..... will it be executing any command or the connection has been setup .. can u help me in this,,
@talhatariqyuluqatdis
@talhatariqyuluqatdis 4 жыл бұрын
your assortment of mugs baffles me
@sinister020
@sinister020 2 жыл бұрын
Hello sentdex, thank you for the tutorial, the problem on the client site is that you have to hit 'enter' to see a message send by someone else, i saw in the comments below that it is a problem because of the send and recieve part in the client code should be separated in two files?I really don't know how to do that but I definitly want to use you script. Is it possible to post an 'how to fix' that? I ( and I think many others) will appreciate that very much. Keep up the good work mate.
@Mohith7548
@Mohith7548 5 жыл бұрын
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?
@TheMoogleee
@TheMoogleee 5 жыл бұрын
So the code that follows the else statement, handles the connection that have already been established but not for the newly created ones right? I'm a little confused
@rubabfatima5449
@rubabfatima5449 5 жыл бұрын
Hi, thanks for the tutorial. Is next tutorial in this series out yet?
@vincenzo3574
@vincenzo3574 5 жыл бұрын
Well, now it surely is
@chiumatthew
@chiumatthew 5 жыл бұрын
Actually, I have just tried myself, and I find a problem. When it server tries to sd back the message to the client, the client-side can only receive the message after another message sd out by the client. How can i fix this problem
@chiumatthew
@chiumatthew 5 жыл бұрын
if the client-side does not sd any message, then it cant receive the message from the others
@Hypenexy
@Hypenexy 4 жыл бұрын
@@chiumatthew I know it's an old comment* but I am also having the same issue. Which technically everyone using this code has. edit: post > comment*
@vijaisiddharthvachaspathit1051
@vijaisiddharthvachaspathit1051 4 жыл бұрын
does this chat application come under a P2P application?
@gameclip4846
@gameclip4846 3 жыл бұрын
the socket work only in my own machine when I try to connect to other machine it not work
@tuhinmukherjee8141
@tuhinmukherjee8141 4 жыл бұрын
Still confused about the selector.selector part. Need to read documentation!
@shimshon9807
@shimshon9807 5 жыл бұрын
great vid but I just don't understand one thing and id be happy to hear an explanation. the line if notified_socket == server_socket: seems like it checks if the socket we are handling is a new one but I don't get how. by my logic we are checking if its equal to the server socket, which it shouldn't be since a new socket from a client is different than the servers socket. im assuming I just don't understand how something with the sockets work but idk what
@thebosscrystal
@thebosscrystal 4 жыл бұрын
I think its when you run the server you're opening a socket and then reading sockets so the server's socket gets read. That line ignores sockets from the current host
@andreamasu5357
@andreamasu5357 5 жыл бұрын
Is it there a way to make a chat that works with different networks? I mean, one client is connected to a network, and another client on another network
@alicememegirl7389
@alicememegirl7389 5 жыл бұрын
Bro, i need this code so much, but i have problem while using python 3.5: .. Server part is require server_socket.listen() argument and wont start without it. I google this problem and after set it "2" because i'm expecting for 2 connections. After that the server part is running (without any prints). Client is fail on part of sending message after i type it, so it give me "BlockingIOError: [Errno 11] Resource temporarily unavailable". The username input part is working properly, but there is no actions in server window, no connections notifier. Also in client part i set username_header = username and message_header = message because i cant use f strings. It's a shame, but i don't get what those two is stands for. If problem in that part i still can't get what is going on with a server_socket.listen(???). Is that because of python version i'm using? Please help me someone, i can't solve it :(
@sentdex
@sentdex 5 жыл бұрын
Upgrade your python, sockets changed since 3.5.
@alicememegirl7389
@alicememegirl7389 5 жыл бұрын
@@sentdex Thank you so much, now it's work fine! :)
@RizwanAli-ki3bx
@RizwanAli-ki3bx 5 жыл бұрын
How is it possible to convert an str to int on line 25?
@vasanthapriya8966
@vasanthapriya8966 3 жыл бұрын
Hi The code works fine. But when client receives message from server, it is showing error. "BlockingIOError: [WinError 10035] A non-blocking socket operation could not be completed immediately" . Can you suggest some solution.
@pythonforintermediates8566
@pythonforintermediates8566 2 жыл бұрын
The tuple doesn't need a space it is just a suggestion from PEP
@zrlcproject
@zrlcproject 3 жыл бұрын
Can sending list data?
@twobits7310
@twobits7310 8 ай бұрын
4:57 such a big mug 😳
@adityarajsingh7617
@adityarajsingh7617 4 жыл бұрын
is it accessable from anywhere in the world?
@ChengPhansivang
@ChengPhansivang 4 жыл бұрын
Hello guys can I ask a question what if I use someone's IP address instead of mine and make the new server for that So what will be happened?
@bgfxc4570
@bgfxc4570 4 жыл бұрын
Are there actually 2 x-class fpv drones in the Background?
@gauravsalibihar3670
@gauravsalibihar3670 4 жыл бұрын
Will IP be different in every one's system
@RMCMC_AmitNikhade
@RMCMC_AmitNikhade 4 жыл бұрын
MY Laptop hangs/freezes after sometimes, after connecting the server to the client and then the whole PC doesn't responses, then i have to directly put it off by forcing it to shutdown by the power button. why is it so??
@crazybob369
@crazybob369 4 жыл бұрын
In function "receive_message(client_socket):" client_socket.recv(message_length) is giving length at one place and data another place. How it is possible? Length in below line: # Receive our "header" containing message length, it's size is defined and constant message_header = client_socket.recv(HEADER_LENGTH) Data in below line: # Return an object of the message header and message data return {'header': message_header, 'data': client_socket.recv(message_length)}
@speedy2050
@speedy2050 4 жыл бұрын
Im getting an error, Undefined variable message in servers.py, since it is set in client.py
@leonardonetagamer
@leonardonetagamer 3 жыл бұрын
So identify it in servers.py
@nemithafernando5756
@nemithafernando5756 3 жыл бұрын
Hey can we use 127.0.0.1 ip to connect any computer on the world? Pls help me this is a big problem.
@Zephyr-tg9hu
@Zephyr-tg9hu 3 жыл бұрын
127.0.0.1 is your loopback address and does not actually involve any communication across the network. The data never actually leaves your computer. So to answer your question, no. If you want to host your server so anyone in the world can connect to it then you'll have to create the server socket using your public IP address and then use port forwarding to redirect the desired traffic to your server when the data enters your network. I recommend reading up more on the basics of networking in order to get this started.
@nemithafernando5756
@nemithafernando5756 3 жыл бұрын
@@Zephyr-tg9hu Thanks for the information . But I tried using ipconfig and it changes everytime when I plugged my Dongal
@nemithafernando5756
@nemithafernando5756 3 жыл бұрын
@@Zephyr-tg9hu Thanks fo the information But my ip address changing sometimes In my knowledge public IP doesn't change
@Zephyr-tg9hu
@Zephyr-tg9hu 3 жыл бұрын
@@nemithafernando5756 Yeah, public IP usually doesn't change since it is a global identifier for your network. Nobody else in the world has the same public IP. On rare occasions your ISP might change it since they are responsible for assigning and maintaining a certain block of IPs. I wouldn't worry about it changing on you, though and even if it does it wont really affect anything for you if you follow good practice and actually grab the public IP from python dynamically instead of feeding it into your program as a constant yourself. Again, for small projects like this I wouldn't worry about this unless you're really paranoid. If you want to route traffic to your server step 1) is to use static addressing so the local IP doesn't change on you. Plenty of videos on KZbin will show you how to configure this on any device. Step 2) is to figure out your routers local IP so you can configure it in your browser. Step 3) is configure your router so that any data coming into your network over the port your server is listening on is redirected over to your server. Again, lots of videos on this since most routers have pretty similar interfaces. Again, read more about the basics of networking! This will sound like super easy stuff if you familiarize yourself. Anyways, hope this helped get you started on the right track.
@Anderon-e36
@Anderon-e36 4 жыл бұрын
This is the first Part of the project?
@BuTTerJaFFaS
@BuTTerJaFFaS 4 жыл бұрын
no, gay.
@madiyarabdukhashimov8570
@madiyarabdukhashimov8570 4 жыл бұрын
I do not know how it seems to others, He teaches so well. I wish some of my professors taught the lectures like him ...)
@arthur6089
@arthur6089 2 жыл бұрын
Seriously ?! He literally surprising to himself about his results. It's so obvious he is copying from a different source and when he is achieving some result so it's like: WOW it works...
@blk612f
@blk612f 5 жыл бұрын
Is it a TCP (or UDP) chatroom? Please help!
@harshakumarks5581
@harshakumarks5581 4 жыл бұрын
TCP, because SOCK_STREAM is used. For UDP we mention SOCK_DGRAM
@theelectronicsguy4218
@theelectronicsguy4218 4 жыл бұрын
@@harshakumarks5581 How to implement it in UDP?
@RajPolinovsky
@RajPolinovsky 5 жыл бұрын
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?
@amoghkaja7642
@amoghkaja7642 5 жыл бұрын
hey @sentdex i want to know how i can link this to an online server so that i could access it from a website, and my friends and i can chat from different cities
@thebosscrystal
@thebosscrystal 4 жыл бұрын
I don't know about accessing from a website. To use the chat out of a local network you'll need a place for your server (server.py). You can also host it from your network after setting up port forwarding from your router to your computer + port. Then you'll connect with public IP + forwarding port. This will need you to give your public IP which shouldn't be a problem with your friends but since its not a fixed IP it may change and will require an update to your program 9to connect to the new IP).
@cicadafiach6915
@cicadafiach6915 4 жыл бұрын
tysm ed snowden
@BuTTerJaFFaS
@BuTTerJaFFaS 4 жыл бұрын
thats not him, gay.
@Cool-rb8nu
@Cool-rb8nu 3 жыл бұрын
You are awesome
@getachewbabulo29
@getachewbabulo29 5 жыл бұрын
it says me @for notified_socket == server_socket: line invalid syntax, help me
@zaferkacmaz8214
@zaferkacmaz8214 5 жыл бұрын
so where is the socket.accept() cause it is required for connection am i wrong?
@thebosscrystal
@thebosscrystal 4 жыл бұрын
Its there when the program gets client_socket and client_address
@xtrondoman
@xtrondoman 5 жыл бұрын
I like your fish cup
@Name-yu6ux
@Name-yu6ux 4 жыл бұрын
WHAT MODULES?
@mockingbird3809
@mockingbird3809 5 жыл бұрын
WOW....This is Interesting.
@mohamedhany44
@mohamedhany44 3 жыл бұрын
thats such a clear and very informatic tutorial but when i applied it the client only receive messages from other when it sends a message
@hamzabouissi1554
@hamzabouissi1554 5 жыл бұрын
can u tell us how many connection can connect into one chatroom ?!
@sentdex
@sentdex 5 жыл бұрын
That's .... what we're doing.
@bobilondon01
@bobilondon01 5 жыл бұрын
does it only work on lan connection
@thebosscrystal
@thebosscrystal 4 жыл бұрын
No, you can port forward your IP and then make the client connect to your public IP (port forwarding)
@rasmir8565
@rasmir8565 5 жыл бұрын
How can we expand this and accept clients from other systems too?
@thebosscrystal
@thebosscrystal 4 жыл бұрын
Create a port forwarding from your public Ip (router) and link it to your computer Ip (local) + port and then connect to your public IP + port chosen. Your public IP may change sometimes and will just require a change in the connection. BAD explanation :(
@figure8379
@figure8379 4 жыл бұрын
​@@thebosscrystalNot a bad explanation. You explained it quite well.
@PanCynik
@PanCynik 5 жыл бұрын
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)?
@BuTTerJaFFaS
@BuTTerJaFFaS 4 жыл бұрын
no, illegal and gay.
@zebusaqua4415
@zebusaqua4415 5 жыл бұрын
Feels good when your a still new at programing and you catch the "utf-8" way before he did.
@tibasicc3737
@tibasicc3737 3 жыл бұрын
Mine said "address already in use" when I ran it, and gave an error on the server_socket.bind((ip, port)) line. If somebody could help me out that would be great!
@floppitommi123
@floppitommi123 2 жыл бұрын
use a different port
@floppitommi123
@floppitommi123 2 жыл бұрын
for example 1234 4567, ...
@Harsh_Reveals
@Harsh_Reveals 4 жыл бұрын
this works for computer over the network
@BuTTerJaFFaS
@BuTTerJaFFaS 4 жыл бұрын
???? r u gay?
@Ibbrahim_ggaming
@Ibbrahim_ggaming 5 жыл бұрын
what are you using?
@charliebooth9268
@charliebooth9268 5 жыл бұрын
ibrahim al baz hes using sublime text
@Ibbrahim_ggaming
@Ibbrahim_ggaming 5 жыл бұрын
@@charliebooth9268 thankyou
@Ibbrahim_ggaming
@Ibbrahim_ggaming 5 жыл бұрын
@@charliebooth9268 Thank you
@BuTTerJaFFaS
@BuTTerJaFFaS 4 жыл бұрын
@@Ibbrahim_ggaming jerkface
@Ibbrahim_ggaming
@Ibbrahim_ggaming 4 жыл бұрын
@@BuTTerJaFFaS butt head
@nemesis515
@nemesis515 5 жыл бұрын
Hey, really good video but, I don't understand : I have a " 'NoneType' object is not subscriptable " error on line 47 and I don't know why. Iwrote the exact same line as you and review it several times but it still don't working. Please, I really need your help :'(
@AlexRixon
@AlexRixon 5 жыл бұрын
Roger gavroche if this is the case then the error originates on line 41 where user is set. Therefore receive_message is returning a none type.
@AlexRixon
@AlexRixon 5 жыл бұрын
Just checked the function. I would suggest you left a return False out and just using return. This will return a none type.
@logical...
@logical... 5 жыл бұрын
what ip do i put in. also what port??
@thebosscrystal
@thebosscrystal 4 жыл бұрын
I'll asume you're using it in a local network (lan) You need to get your current computer's IP (for host) on windows you can run ipconfig /all and find IPV4 Address. For the port you chose a port and use the same one from the program
Python Socket Programming Tutorial
49:43
Tech With Tim
Рет қаралды 1 МЛН
Непосредственно Каха: сумка
0:53
К-Media
Рет қаралды 12 МЛН
Hilarious FAKE TONGUE Prank by WEDNESDAY😏🖤
0:39
La La Life Shorts
Рет қаралды 44 МЛН
Жездуха 42-серия
29:26
Million Show
Рет қаралды 2,6 МЛН
Python Sockets Simply Explained
39:33
NeuralNine
Рет қаралды 170 М.
Modern Graphical User Interfaces in Python
11:12
NeuralNine
Рет қаралды 1,6 МЛН
Python Socket Programming - Multiple Clients Chat
9:38
WittCode
Рет қаралды 1,7 М.
Coding Encrypted Chat in Python
20:33
NeuralNine
Рет қаралды 51 М.
AI Is Making You An Illiterate Programmer
27:22
ThePrimeTime
Рет қаралды 65 М.
Creating a Simple Socket Server and Client in Python
15:44
Real Python
Рет қаралды 27 М.
Websockets in Python
17:52
APMonitor.com
Рет қаралды 43 М.