This was a great tutorial, I love how you explained each step and each function and parameter, this is exactly what I was looking for and struggling with the most. Thank you so much dude!
Excellent video and explanation... I am new to network programming but grasped this very quickly bcz of the easy way of explaining each and every step.
Thank you for this video! Very easy to understand for python n00bs like myself. I had a few questions if you have the time; 1. Is there a way to eliminate the senders typed message, to prevent it from doubling on the senders screen? 2. Is there a way to prevent user messages that are posted when you are typing from showing up in the message you are writing? 3. Any possibility of a follow up vid with login/encryption? :D Again, thank you.
Thanks a lot , appreciate it 😊 Regarding the first 2 questions; we can absolutely tweak in the code to hide messages ( sender/receiver ) to avoid double appearance but this was just for demonstration purpose :) As far as a follow up video for a login mechanism, I can’t promise in the near future but I’ll add it to my YT projects list :)
I love you really, I figured how this works after a couple days searching for that clear explaintation. Sadly you dont have videos how to implement crash fault tolerance, reliable ordered multicast, voting and dynamic discovery of hosts :(
It says established connection with so and so but immediately shows error in alias.recv and the error is "An existing connection was forcibly closed by the remote host"
Yes i did I didn't reply earlier because i don't want to sound stupid infront of you so i made my search. Turns out i forgot to start the client thread because i didn't add receive_thread.start() at the client side
Hi Daniel ! Your question is a tough one 😄 There will be a lot of caveats to tackle down the road : 1- some configuration on the router of the computers on that other LAN . The reason is that nowadays everybody has a public IP address that is provided by your ISP ( internet service provider) This IP address is not fixed, but it is easy to lookup what is ur ip (whatismyip.com) 2 - sending is not going to be a problem, but receiving is. Some service providers like here in Poland don't allow just any port to be used and you have to find out which ports are allowed. The well known ports are most likely not allowed. That for instance makes it impossible to host a webserver without first contacting your ISP. It’s really not easy and require some experience in networking I’ll try in the future to answer your question with a live demo using sockets in python - thanks for your question, Daniel
@@metalnick749Ok got you now ; it’s very tough but possible There will be a lot of problems to tackle down the road : 1- some configuration on the router of the computers on that other LAN . The reason is that nowadays everybody has a public IP address that is provided by your ISP ( internet service provider) This IP address is not fixed, but it is easy to lookup what is ur ip (whatismyip.com) 2 - sending is not going to be a problem, but receiving is. Some service providers like here in Poland don't allow just any port to be used and you have to find out which ports are allowed. The well known ports are most likely not allowed. That for instance makes it impossible to host a webserver without first contacting your ISP. It’s really not easy and requires some experience in networking
Thank you, Justin. Yes, you need to call 2 methods whenever you want to shut down the server : shutdown() and close(). You can create a function and call it at the end of your code block : def terminate(): server.shutdown(socket.SHUT_RDWR) server.close() Don’t forget the indentation in terminate() function
Hey Divan 👋 There will be a lot of problems to tackle down the road if you want to host it online: 1- some configuration on the router of the computers on that other LAN . The reason is that nowadays everybody has a public IP address that is provided by your ISP ( internet service provider) This IP address is not fixed, but it is easy to lookup what is ur ip (whatismyip.com) 2 - sending is not going to be a problem, but receiving is. Some service providers like here in Poland don't allow just any port to be used and you have to find out which ports are allowed. The well known ports are most likely not allowed. That for instance makes it impossible to host a webserver without first contacting your ISP. It’s really not easy and requires some experience in networking
@@BekBrace Hi thanks for the reply. But I cannot host it on my machine/router due to the way my ISP works. Incomming connections will never reach my router as a result. What I am looking for is a cloud solution. I have experience with deploying a C# webAPI to Azure (app service) but it seems that a TCP server like this, is not that easy!
i ran this once and it was running perfectly but now i keep getting this error (OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted) whats that about?
Very nice ! But does anyone know why I don't get the chat updated in my git bash window(s)? They only update if I (from this git bash window) write a message. ... One of my clients is started in pycharm. There I have live chat update the way the git bash instances have it in the video.
@@BekBrace Yes, let's say I have three clients 1. "Git Bash A Client", 2. "Git Bash B Client" and 3. "Pycharm Client" (which only means this time I run the code directly in pycharm and not from git bash or cmd line or so). And the server is of course running. Problem is: "Git Bash A Client" sends message: Despite of the broadcast functionality of the server, only my "Pycharm Client" directly sees the message. "Git Bash B Client" is not updated with the text sent by "Git Bash A Client". But obviously anywhere in the background of "Git Bash B Client" the message must have been received because when I now send a message from "Git Bash B Client" the moment I press "ENTER" the old messages appear. I mean it's not really relevant for what I want to do but I asked my self what's the problem here...Maybe my git bash Version. I don't know. Best regards from MUC, GER
Hey Tech Tok. As far as I'm aware this is very easily done using Django channels. Unfortunately, I don't have django channels course or tutorial on the channel, but I might consider doing one just to show you how to connect a client - client or to disconnect a client from the chatroom
Hi man, my two questions may seem dumber than the others which have been asked. For creating this chatroom, I don't need a Python server like on PythonAnywhere, OpenShift, and all the other Python servers hosting services, right? And this chatroom only works for people on my LAN or on my own PC only? Because I can see it running on localhost
This works only on localhost, it's not publicly available. I've answered this question many times, so one of my answers was : There will be a lot of caveats to tackle down the road : 1- some configuration on the router of the computers on that other LAN . The reason is that nowadays everybody has a public IP address that is provided by your ISP ( internet service provider) This IP address is not fixed, but it is easy to lookup what is ur ip (whatismyip.com) 2 - sending is not going to be a problem, but receiving is. Some service providers like here in Poland don't allow just any port to be used and you have to find out which ports are allowed. The well known ports are most likely not allowed. That for instance makes it impossible to host a webserver without first contacting your ISP. It’s really not easy and require some experience in networking
I doubt that , the core nature of tcp and udp is totally different, because udp doesn’t establish a connection before data is sent while tcp is connection focused protocol
What's your point (if you have any?) and what does neurlanine mean ? In any case, this is the standard setup for multiple clients consumption and one local server in Python.
This was a great tutorial, I love how you explained each step and each function and parameter, this is exactly what I was looking for and struggling with the most. Thank you so much dude!
Yoni my friend, so glad you liked it 🙂🙏
Oh,you're so kind.almost reply to every comment.I am a colloge student from China and I appreciate the video so much.
Thank you so much my friend, and best of luck to you in your studies ☺️
you're a god, I've been looking how to do exactly that in a lot of places and none of them described it so easily. ❤
Thanks so much my friend for the compliment 😊 I'm a simple human being 🤠
oh wow this is a gem 💎 in an ocean ! Thanks Bek and keep doing these networking video series
Agree!
Thank you very much for such kind words , I appreciate it !
@@BekBrace I didn't sub any python channel but I will sub you coz ur awesome explaination
Flawless!! You deserve more views ! Love the section division too - keep it up buddy
Mourir S. Malak Thank you so much 😊
Thank you so much Bek! I found your code on github but I was unable to understand it, then I searched on YT and then found this 💎 of a playlist !
Hey Ritesh 🙂 Thank you!
thanks so much for this toturial, absolutly amazing!!!!!!!!!!!
Thank you so much for watching, my friend
wonderful video! all things that I've needed from socket module. thank you very much.
@@helloparviz I'm glad my friend 🙏
Excellent video and explanation... I am new to network programming but grasped this very quickly bcz of the easy way of explaining each and every step.
Great 😃👍 Thanks so much
Loved it man! Thanks for creating this tutorial series :)
Thank you Ayush ☺️
Magnificant explanation , thanks.
Thank you my friend
@@BekBrace ❤
Thanks for these videos i was think about learning this for some time
👍 Enjoy my friend
Excellent vid man! Thanks so much
You're welcome, Jeremy 😊 and Thank You for watching
Thank you for this video! Very easy to understand for python n00bs like myself.
I had a few questions if you have the time;
1. Is there a way to eliminate the senders typed message, to prevent it from doubling on the senders screen?
2. Is there a way to prevent user messages that are posted when you are typing from showing up in the message you are writing?
3. Any possibility of a follow up vid with login/encryption? :D
Again, thank you.
Thanks a lot , appreciate it 😊
Regarding the first 2 questions; we can absolutely tweak in the code to hide messages ( sender/receiver ) to avoid double appearance but this was just for demonstration purpose :)
As far as a follow up video for a login mechanism, I can’t promise in the near future but I’ll add it to my YT projects list :)
@@BekBrace Much appreciated sir. Thank you!
This is a perfect video, thank you for your work.
Thanks MrDark , glad you liked it 🙂
I love you really, I figured how this works after a couple days searching for that clear explaintation. Sadly you dont have videos how to implement crash fault tolerance, reliable ordered multicast, voting and dynamic discovery of hosts :(
Do you have maybe good sources for those topics? I sadly dont find nothing good stuff :(
@@HankeyMassacre if you mean books, then no , but these topics are all over the web
oh my god thanks a lot this is exactly what i was looking for
@@mithra05jk My pleasure 🙂
You can tell he knows what hes doing great work
Thanks 🙏
thanks, it was great help for mu studies!
Thank you Olga 😊 Glad you found it useful
It says established connection with so and so but immediately shows error in alias.recv and the error is
"An existing connection was forcibly closed by the remote host"
Have you tried to search for that error on the internet in stack overflow or Google ?
Yes i did
I didn't reply earlier because i don't want to sound stupid infront of you so i made my search.
Turns out i forgot to start the client thread because i didn't add receive_thread.start() at the client side
Talk about not wanting to sound stupid 🤣
@@Majed_ashraf I have receive_thread.start() in my code but im still getting that same error message
how can i request a list of the aliases for all other connected clients ? in the client ??
Hey Hatem. I'll find a solution And will let you know
@@BekBrace ❤️❤️ 🙏
Thankyouu ...It's amazingggg ! ....Loved it !!
So glad to hear my friend
you are a amazing thanks i learned alot from you
Thanks a lot, Gamer, means a lot to me 🙂
Hey good video, I did the chat room in my network
How can I do it using computers from other networks?
Hi Daniel !
Your question is a tough one 😄
There will be a lot of caveats to tackle down the road : 1- some configuration on the router of the computers on that other LAN .
The reason is that nowadays everybody has a public IP address that is provided by your ISP ( internet service provider) This IP address is not fixed, but it is easy to lookup what is ur ip (whatismyip.com)
2 - sending is not going to be a problem, but receiving is. Some service providers like here in Poland don't allow just any port to be used and you have to find out which ports are allowed. The well known ports are most likely not allowed. That for instance makes it impossible to host a webserver without first contacting your ISP.
It’s really not easy and require some experience in networking
I’ll try in the future to answer your question with a live demo using sockets in python - thanks for your question, Daniel
@@BekBrace Thank you 😁👍
@@danielbd6490 No worries , if you’ve got any questions just let me know - cheers 🍻
Nice Tutorial. Is it possible for clients to connect with different ips?
Thanks man ; yes but it would be very difficult to achieve this + for which purpose ?
@@BekBrace Thanks for your respond. Just for chat. For example, me the host start the server and my friends can connect and chat.
@@metalnick749Ok got you now ; it’s very tough but possible
There will be a lot of problems to tackle down the road : 1- some configuration on the router of the computers on that other LAN .
The reason is that nowadays everybody has a public IP address that is provided by your ISP ( internet service provider) This IP address is not fixed, but it is easy to lookup what is ur ip (whatismyip.com)
2 - sending is not going to be a problem, but receiving is. Some service providers like here in Poland don't allow just any port to be used and you have to find out which ports are allowed. The well known ports are most likely not allowed. That for instance makes it impossible to host a webserver without first contacting your ISP.
It’s really not easy and requires some experience in networking
This tutorial has been very helpful, but I can't figure out how to shut the server down. Do you have any advice??
Thank you, Justin.
Yes, you need to call 2 methods whenever you want to shut down the server : shutdown() and close().
You can create a function and call it at the end of your code block :
def terminate(): server.shutdown(socket.SHUT_RDWR)
server.close()
Don’t forget the indentation in terminate() function
Bro I'm trying to host a chat server like that on the internet. All tutorials just run the server on local machine. What can one use?
Hey Divan 👋
There will be a lot of problems to tackle down the road if you want to host it online:
1- some configuration on the router of the computers on that other LAN .
The reason is that nowadays everybody has a public IP address that is provided by your ISP ( internet service provider) This IP address is not fixed, but it is easy to lookup what is ur ip (whatismyip.com)
2 - sending is not going to be a problem, but receiving is. Some service providers like here in Poland don't allow just any port to be used and you have to find out which ports are allowed. The well known ports are most likely not allowed. That for instance makes it impossible to host a webserver without first contacting your ISP.
It’s really not easy and requires some experience in networking
@@BekBrace Hi thanks for the reply. But I cannot host it on my machine/router due to the way my ISP works. Incomming connections will never reach my router as a result.
What I am looking for is a cloud solution. I have experience with deploying a C# webAPI to Azure (app service) but it seems that a TCP server like this, is not that easy!
did you ever figure it out? im trying to do the same
@@user-kg1mw9ld9o Yes, I used the Azure SignalR service. SignalR is a C# library, its essentislly an abstraction layer over websockets.
Awesome video!!!!!!!!!
Thanks Steve
great thank you, just to check what is bash
You're welcome
i ran this once and it was running perfectly but now i keep getting this error (OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted) whats that about?
ohhhh I get it now, the port was active all I had to do was change it. It's working now :)
@@juni8031 اهلا ريم و اسف علي التاخر في الرد - مرحبا بك في اى وقت 🙂
And I’m glad it’s working ok now- cheers
@@BekBrace la 3adi, used this as reference for my school project :) thanks 7bebe!
Very nice ! But does anyone know why I don't get the chat updated in my git bash window(s)? They only update if I (from this git bash window) write a message. ... One of my clients is started in pycharm. There I have live chat update the way the git bash instances have it in the video.
Hello Lukas. Thank you for your comment 😊 can you rephrase your question cause I didn't quite understand
@@BekBrace Yes, let's say I have three clients 1. "Git Bash A Client", 2. "Git Bash B Client" and 3. "Pycharm Client" (which only means this time I run the code directly in pycharm and not from git bash or cmd line or so). And the server is of course running.
Problem is: "Git Bash A Client" sends message: Despite of the broadcast functionality of the server, only my "Pycharm Client" directly sees the message. "Git Bash B Client" is not updated with the text sent by "Git Bash A Client". But obviously anywhere in the background of "Git Bash B Client" the message must have been received because when I now send a message from "Git Bash B Client" the moment I press "ENTER" the old messages appear. I mean it's not really relevant for what I want to do but I asked my self what's the problem here...Maybe my git bash Version. I don't know. Best regards from MUC, GER
thank you so much.. can you plz tell me how to disconnect client from the chatroom??
and if we want to connect client with other specific client only how to approach it??
Hey Tech Tok. As far as I'm aware this is very easily done using Django channels. Unfortunately, I don't have django channels course or tutorial on the channel, but I might consider doing one just to show you how to connect a client - client or to disconnect a client from the chatroom
@@BekBrace that will be so helpful.. thx btw for detailed explaination
What do I need to put on the client file if the server is on another computer on the same wifi network ?
It is almost impossible
The write thread glitches on my end, was there an update recently that possibly caused this? When ran on my raspberry pi, it crashes
Hey. As far as I know, no updates, but I don't think that running on pi would cause a crash; do you get an error message of some sort ?
Can this program to set GUI
Yes absolutely , in fact I was thinking of refactoring the code while adding a UI to it 🙂
Hi man, my two questions may seem dumber than the others which have been asked. For creating this chatroom, I don't need a Python server like on PythonAnywhere, OpenShift, and all the other Python servers hosting services, right? And this chatroom only works for people on my LAN or on my own PC only? Because I can see it running on localhost
You can ask anything you want my friend :)
For creating a a server using Python, you can only use socket programming like show in the demonstration.
how to modify it so it work over the internet?????
This works only on localhost, it's not publicly available. I've answered this question many times, so one of my answers was :
There will be a lot of caveats to tackle down the road : 1- some configuration on the router of the computers on that other LAN .
The reason is that nowadays everybody has a public IP address that is provided by your ISP ( internet service provider) This IP address is not fixed, but it is easy to lookup what is ur ip (whatismyip.com)
2 - sending is not going to be a problem, but receiving is. Some service providers like here in Poland don't allow just any port to be used and you have to find out which ports are allowed. The well known ports are most likely not allowed. That for instance makes it impossible to host a webserver without first contacting your ISP.
It’s really not easy and require some experience in networking
I got a task to built the same program, but in udp. Is it still using the same way?
I doubt that , the core nature of tcp and udp is totally different, because udp doesn’t establish a connection before data is sent while tcp is connection focused protocol
Very very thank you
You're welcome, Imane
😎
How u open (git bash here)
I clicked on the icon ?
Yes but i can't do that
I don't have it
very cool !
Thanks Nina !
Which ide?
That’s not IDE, it’s code editor : Visual Studio Code
erorr - OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted
Yes, so make sure that the port you’re using isn’t active otherwise you have to change it so the connection can work
@@BekBrace How to make this work in real time
@@BekBrace server is not working
now ok sorry .my terminal erorr
This program can not chat between 2 computers .On one computer can only have two cmd panels
That’s it yes.
Or if on the same network.
@@BekBrace winError 10061
today I created my application using a socket
Молодец!!!
@@BekBrace 😀
Bestttt
Thank you 😊
this looks like the code from neuralnine
What's your point (if you have any?) and what does neurlanine mean ?
In any case, this is the standard setup for multiple clients consumption and one local server in Python.
Very very thank you
You're very welcome