UDP Peer-To-Peer Messaging With Python

  Рет қаралды 57,175

Engineer Man

Engineer Man

3 жыл бұрын

Part 2 is here for UDP p2p connections. In the first video I used netcat, in this video I'll use Python instead and streamline the connection process using a rendezvous server.
Hope you enjoyed the video!
Part 1: • How To Create UDP Peer...
Check out this code here:
github.com/engineer-man/youtu...
Join my Discord server and come say hi:
/ discord
Check out some code on my GitHub:
github.com/realtux
github.com/engineer-man/youtube
Send me a Gab:
gab.com/engineerman
Other Social:
/ engineerman
/ _engineerman
/ engineermanyt

Пікірлер: 86
@G_O584
@G_O584 3 жыл бұрын
fantastic bite sized and actually useful tutorials, love it man. keep these up!
@davdiaz24
@davdiaz24 Жыл бұрын
Finally someone who can keep my attention by giving us the meat and potatoes of a subject. I enjoy these short version videos due to my attention span and how he can explain things in a way that's easy to digest. Super glad I found this channel.
@corotoz5513
@corotoz5513 3 жыл бұрын
Learning python rn and u posted this, perfect timing.
@hmauroy
@hmauroy 2 жыл бұрын
Now I know more about udp. Thank you for a short and to the point video!
@Usertrappedindatabase
@Usertrappedindatabase 3 жыл бұрын
really great stuff, inspired me to take a look at stuff, tons of other connections you can make with socket library in python3.
@BrickTamlandOfficial
@BrickTamlandOfficial 3 жыл бұрын
lol this reminds me back in the xp days when we would send custom error boxes to computers in the computer lab
@mrbushido5307
@mrbushido5307 2 жыл бұрын
epic tutorials, concise, to the point, love it.
@tmsw7060
@tmsw7060 3 жыл бұрын
Awesome I was waiting for this!
@marcellmunnich1094
@marcellmunnich1094 2 жыл бұрын
Exactly what I was looking for! Thanks!
@orestesom
@orestesom 3 жыл бұрын
Next level of content men!
@nexuz4258
@nexuz4258 2 жыл бұрын
Could you make a video on what methods there are to find peers (Bittorrent DHT, Gnutella etc)
@aminghafoori6496
@aminghafoori6496 3 жыл бұрын
i was waiting for this thanks
@ThrillDaWill
@ThrillDaWill 2 жыл бұрын
Does this only work with virtual machines? or can it also be used with vpns and another laptop?
@kashyapjain2018
@kashyapjain2018 2 жыл бұрын
Will it work with dynamic ips of clients as here I assume you have static ips for your vm
@soupnoodles
@soupnoodles 2 ай бұрын
YESSS this is what I needed
@liamalon923
@liamalon923 2 жыл бұрын
If i want to talk with computers on different networks, is it possible and if it is where would the server run?
@PawitSahare
@PawitSahare Жыл бұрын
I have a question sir, is required port forwarding or it work over the internet pls tell me..
@ipianomidivisualizer121
@ipianomidivisualizer121 2 жыл бұрын
Will it be possible to communicate Peer-To-Peer over the internet using Microcontrollers like ESP32 ?
@cubeofmars291
@cubeofmars291 3 жыл бұрын
What code editor do you use?
@MazJackson
@MazJackson Жыл бұрын
Thank you so much for sharing! I think it would be beneficial to know how to dockerised a peer to peer newtwork for local development. I'm currently trying to figure this out myself and it's not the most straight forward. I keep getting addresses already in use errors
@El-Burrito
@El-Burrito 3 жыл бұрын
Super awesome!
@garypaulson5202
@garypaulson5202 2 жыл бұрын
Brilliant!
@littleweenie9142
@littleweenie9142 3 жыл бұрын
Hey, how do you edit multiple lines of code at once?
@comediavietii1245
@comediavietii1245 2 жыл бұрын
Drink 5 liters of beer 🍻
@Adjust91
@Adjust91 3 жыл бұрын
Is there much of a prereq required to learn Python? I understand it’s the “east” language to pick up, however I’ve already begun learning JavaScript and react for front end web dev, my reason for this is that I heard for the “better” Python jobs you really need a strong math background, which I do not have… however Python looks so nice I’m almost certain I’ll start learning it after I get a job with JavaScript as I’d like to eventually move into a back end position.
@yv1547
@yv1547 3 жыл бұрын
For basic python, I just jumped right in to learning it. Of course it wasn’t easy, but now I’m fluent and pretty much all self-taught. If you have a basic understanding of computers and how programming works I’m sure you’ll be fine. Math is important, but you won’t need complex math until you tackle difficult problems for upper-end projects.
@Adjust91
@Adjust91 3 жыл бұрын
Appreciate it :) I’m very confident with my basic JavaScript so far and am just starting react, will be adding Python to my resume once I land a job using JavaScript and feel comfortable enough to branch out
@ayazalavi
@ayazalavi 3 ай бұрын
what if router assign different ports than 50001 and 50002. In my case this is happening and I am unable to recevie messages
@sabinbaral4132
@sabinbaral4132 3 жыл бұрын
Sir you are the best 🙏
@MR-uk7iy
@MR-uk7iy 3 жыл бұрын
Imagine going to school and actually learning this stuff, instead of reading about it
@JulioCezar-bl5jt
@JulioCezar-bl5jt 2 жыл бұрын
Does it work on different networks?
@funkykong9001
@funkykong9001 3 жыл бұрын
Why don't you use the cleaner f-strings with print() and sock.sendto()?
@toastybatch565
@toastybatch565 3 жыл бұрын
fstrings also have better performance concatenating several strings
@Egon3k
@Egon3k Жыл бұрын
first i wanted to ask if this is really p2p by definition because of the server involved - then i watched your other video :D nice explanation even for total noobies like me :)
@pz_bowmaking8861
@pz_bowmaking8861 2 жыл бұрын
I tried this code on github serveral times, I always get an error says adress already in use, how can I fix this???
@nagasaipavanswaroopainapur6539
@nagasaipavanswaroopainapur6539 2 жыл бұрын
same problem, could you solve this?
2 жыл бұрын
@@nagasaipavanswaroopainapur6539 Alguma solução? address already in use :(
2 жыл бұрын
Any solution?
@0xTas
@0xTas 2 жыл бұрын
@ This is happening because a socket is bound to the source-port variable "sport" on line 36 of the script, and then immediately the script tries to bind another socket to that same port on line 45 inside the listen() function when it calls it via Threading on lines 51/52, which is what causes this error. Two sockets cannot bind to the same port at the same time. You can fix this by adding a 'sock.close()' to line 40. P.S. I would also recommend wrapping all blocking calls like sock.recv() in try..except..finally blocks so you can catch KeyboardInterrupts and properly terminate the socket with sock.close(), otherwise you may have dangling background processes using those ports which will also cause this error until they timeout.
@philtoa334
@philtoa334 3 жыл бұрын
Nice.
@gr0nis
@gr0nis 3 жыл бұрын
A correction about how well supported this is. Depending on your network’s NAT port mapping implementation, it might be impossible for certain peers to establish a connection. However, you didn’t touch on the subject of NAT so I guess it is out of scope for this video.
@otmanmouhib5220
@otmanmouhib5220 2 жыл бұрын
please explication because i am having some serious problemms with that it works with my local ip but not my public ip
@JirkaKlimes_
@JirkaKlimes_ 2 жыл бұрын
I am having trouble making this work on 4G internet. Is it even possible? I would think so, because torrent is working just fine. Any idea on why it's not working?
@younginnovatorscenterofint8986
@younginnovatorscenterofint8986 Жыл бұрын
how about peer-to-peer connection,able to get access to the other pc using python?
@collinxsmith
@collinxsmith 3 жыл бұрын
Very cool! Is it possible to create a UDP connection like this between two devices over the same LAN?
@EngineerMan
@EngineerMan 3 жыл бұрын
Depends how smart your router is, but usually yes.
@abdelrahmanakram8071
@abdelrahmanakram8071 2 жыл бұрын
@@EngineerMan does this work on windows too !?
@GeorgeValkov
@GeorgeValkov 2 жыл бұрын
Yes. A fun story: my neighbour once called to tell me Internet is not working. We were on the same LAN and Skype figured it can connect directly without Internet. I've seen other tools do it as well.
@marcinziajkowski3870
@marcinziajkowski3870 3 жыл бұрын
Thank u
@yukchow4821
@yukchow4821 3 жыл бұрын
Is the rendezvous server a public server? Are there any free public servers available for testing?
@Richard-xu7kz
@Richard-xu7kz 2 жыл бұрын
For little money you can use digital ocean to spin up a few vms, which I believe he is using in this video. Spin up 3 linux vms all with public vms in different geographical locations.
@yukchow4821
@yukchow4821 2 жыл бұрын
@@Richard-xu7kz Many thanks for the suggestion, cheers. I also checking up with Heroku.
@Ftoy-OG
@Ftoy-OG 2 жыл бұрын
the rendezvous server is public(port forwarded) to accept the udp messages of the 2 clients .
@tchnque2234
@tchnque2234 Жыл бұрын
what about tcp implementation?
@ahhdum64
@ahhdum64 3 жыл бұрын
Woah, first view! Love the content!
@EngineerMan
@EngineerMan 3 жыл бұрын
Nice work :)
@Andremzsptm
@Andremzsptm 3 жыл бұрын
@@EngineerMan any plans to make some RabbitMQ content?
@ppacory
@ppacory 6 ай бұрын
thks for this nice video, is there a source code for the rendezvous server ?
@Stoney_Eagle
@Stoney_Eagle 3 жыл бұрын
Can you create a simple example for portless communication between NodeJS and React?
@xerrion
@xerrion 3 жыл бұрын
You could use the BroadcastChannel from the web api, theres a npm package that integrates it into node.
@wkdj2522
@wkdj2522 2 жыл бұрын
awesome! what would happen if both sent messages at the exact same time?
@Ftoy-OG
@Ftoy-OG 2 жыл бұрын
the listeners are threaded they would work fine .
@HardcoreTech-wg9bm
@HardcoreTech-wg9bm Жыл бұрын
that's awesome bro, by the way , I wanna know how can I apply file transferring in Python too, I am looking forward to this tutorial
@user-kh5rq8fu2b
@user-kh5rq8fu2b 7 ай бұрын
Hi, good tutorial, but... it will not work when clients are behind firewall. You use static port 50002 to listen on and to send to. Behind firewall port number will change to random givet by router.
@roserosie4322
@roserosie4322 2 жыл бұрын
Looking for peer to peer connection between two clients only
@soupnoodles
@soupnoodles 2 ай бұрын
could you write the scripts from scratch? this is a bit hard to follow
@dougphillips5686
@dougphillips5686 Жыл бұрын
I would like to see an update using encryption
@Blasterxp
@Blasterxp 2 жыл бұрын
Can this be blocked?
@vladusa
@vladusa 2 жыл бұрын
Peer discovery is way better with what UDP provides.
@otmanmouhib5220
@otmanmouhib5220 2 жыл бұрын
why does it work with my private ip and not mu public ip !!!!!!!! HELP i m going nuts
@friendlybear5924
@friendlybear5924 Жыл бұрын
If you implement a rendezvous server that forwards traffic between clients, that doesn't quite fit the term "peer to peer".
@commanderlegolas
@commanderlegolas 3 ай бұрын
It's used to tell each of the clients the IP address and socket of the other client. After that I believe it doesn't do anything else
@Wrigaaro
@Wrigaaro 3 жыл бұрын
How secure is the UDP connection type? If one was to make an application to carry sensitive data, would UDP connections be safe?... and/or what type of sensitive doc/chat would you consider safe? (If we remove, from this scenario, the potential security risk of the front end application components and just focusing on the UDP part)
@shadowaker6260
@shadowaker6260 3 жыл бұрын
It is not safe at all, the only security barrier is the server, if it is random or can encrypt the first connection, but is very thin as a barrier. A man in the middle attack or a spyware that monitors all traffic can easily intercept all data exchanged
@Richard-xu7kz
@Richard-xu7kz 2 жыл бұрын
Also UDP data transmission can be unreliable and doesnt do any error checking (there is more but google tcp vs udp). Can you think of the impact this may have on encrypted messages?
@tomblitz22
@tomblitz22 2 жыл бұрын
UDP on its own isn’t secure, the same goes for TCP. You can use HTTP(S)3 which uses UDP to provide secure connections.
@iamemil9782
@iamemil9782 7 ай бұрын
Why did you write Client and Server? I thought a Peer To Peer connection doesn't have a server.
@dominykas5195
@dominykas5195 7 ай бұрын
server just gives the clients their peers details
@iamemil9782
@iamemil9782 7 ай бұрын
@@dominykas5195 ok, thx
@trishantpahwa6554
@trishantpahwa6554 2 жыл бұрын
You’re not hole punching. You’re creating a socket on your machine. Hole punching is related to STUN servers that by pass NAT to reach your socket.
@gerooq
@gerooq 7 ай бұрын
He *is* hole punching, this would work to connect devices on completely different networks across the planet without a request/response 3-tier architecture. Simple opening a socket on your device doesn't do anything unless you port forward on your NAT which he isn't doing.
@melsonmascarenhas
@melsonmascarenhas Жыл бұрын
This code will not work peer behind NAT.
@anthonyfuentes1179
@anthonyfuentes1179 2 жыл бұрын
Imagine being the 1 guy that disliked the video
@mohamedalloui
@mohamedalloui 3 жыл бұрын
Hi bro can you punish another scammer using your skills like you did in the other video that you posted before? I can provide you with an email that I got from a scammer asking me to pay in order for them to return a package, which is not true, to my address. They ask for credit card details.
@xerrion
@xerrion 3 жыл бұрын
I would tell you a joke. But you might not get it.
How To Create UDP Peer-To-Peer Connections With Netcat
8:56
Engineer Man
Рет қаралды 34 М.
TCP vs UDP Sockets in Python
17:43
NeuralNine
Рет қаралды 30 М.
ОБЯЗАТЕЛЬНО СОВЕРШАЙТЕ ДОБРО!❤❤❤
00:45
路飞太过分了,自己游泳。#海贼王#路飞
00:28
路飞与唐舞桐
Рет қаралды 38 МЛН
Threading vs Multiprocessing in Python
6:45
Engineer Man
Рет қаралды 198 М.
Python Sockets Simply Explained
39:33
NeuralNine
Рет қаралды 159 М.
Difficult Programming Concepts Explained
11:13
Engineer Man
Рет қаралды 69 М.
Engineer Breaks Down Hollywood Programming Scenes
11:02
Engineer Man
Рет қаралды 22 М.
PLEASE Use These 5 Python Decorators
20:12
Tech With Tim
Рет қаралды 105 М.
UDP doesn't suck! It's the BEST L4 protocol for THESE types of applications...
11:52
~/.dotfiles in 100 Seconds
13:54
Fireship
Рет қаралды 413 М.
Python Asynchronous Programming - AsyncIO & Async/Await
25:57
Tech With Tim
Рет қаралды 421 М.
8.2 How to Create a WebSocket Server in Python - Fun with WebSockets
30:47
Understanding Fork Bombs in 5 Minutes or Less
5:55
Engineer Man
Рет қаралды 168 М.
Лучший браузер!
0:27
Honey Montana
Рет қаралды 1,1 МЛН
ноутбуки от 7.900 в тг laptopshoptop
0:14
Ноутбуковая лавка
Рет қаралды 3,5 МЛН
$1 vs $100,000 Slow Motion Camera!
0:44
Hafu Go
Рет қаралды 29 МЛН
Samsung laughing on iPhone #techbyakram
0:12
Tech by Akram
Рет қаралды 7 МЛН