UDP Peer-To-Peer Messaging With Python

Поділитися
Вставка
  • Опубліковано 22 жов 2024

КОМЕНТАРІ • 84

  • @G_O584
    @G_O584 3 роки тому +30

    fantastic bite sized and actually useful tutorials, love it man. keep these up!

  • @BrickTamlandOfficial
    @BrickTamlandOfficial 3 роки тому +9

    lol this reminds me back in the xp days when we would send custom error boxes to computers in the computer lab

  • @corotoz5513
    @corotoz5513 3 роки тому +8

    Learning python rn and u posted this, perfect timing.

  • @Usertrappedindatabase
    @Usertrappedindatabase 3 роки тому +4

    really great stuff, inspired me to take a look at stuff, tons of other connections you can make with socket library in python3.

  • @nexuz4258
    @nexuz4258 3 роки тому +4

    Could you make a video on what methods there are to find peers (Bittorrent DHT, Gnutella etc)

  • @davdiaz24
    @davdiaz24 Рік тому +1

    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.

  • @gr0nis
    @gr0nis 3 роки тому +5

    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

  • @MazJackson
    @MazJackson Рік тому +1

    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

  • @hmauroy
    @hmauroy 2 роки тому

    Now I know more about udp. Thank you for a short and to the point video!

  • @ThrillDaWill
    @ThrillDaWill 2 роки тому

    Does this only work with virtual machines? or can it also be used with vpns and another laptop?

  • @MR-uk7iy
    @MR-uk7iy 3 роки тому +1

    Imagine going to school and actually learning this stuff, instead of reading about it

  • @Adjust91
    @Adjust91 3 роки тому +1

    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 роки тому +1

      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

  • @mrbushido5307
    @mrbushido5307 2 роки тому +2

    epic tutorials, concise, to the point, love it.

  • @funkykong9001
    @funkykong9001 3 роки тому +2

    Why don't you use the cleaner f-strings with print() and sock.sendto()?

    • @toastybatch565
      @toastybatch565 3 роки тому +1

      fstrings also have better performance concatenating several strings

  • @PawitSahare
    @PawitSahare Рік тому

    I have a question sir, is required port forwarding or it work over the internet pls tell me..

  • @pz_bowmaking8861
    @pz_bowmaking8861 2 роки тому +4

    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 роки тому +1

      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.

  • @marcellmunnich1094
    @marcellmunnich1094 2 роки тому

    Exactly what I was looking for! Thanks!

  • @DanielM-u9k
    @DanielM-u9k 10 місяців тому

    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.

  • @kashyapjain2018
    @kashyapjain2018 2 роки тому

    Will it work with dynamic ips of clients as here I assume you have static ips for your vm

  • @vladusa
    @vladusa 2 роки тому +1

    Peer discovery is way better with what UDP provides.

  • @collinxsmith
    @collinxsmith 3 роки тому +1

    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 3 роки тому

      @@EngineerMan does this work on windows too !?

    • @GeorgeValkov
      @GeorgeValkov 2 роки тому +1

      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.

  • @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 :)

  • @friendlybear5924
    @friendlybear5924 2 роки тому

    If you implement a rendezvous server that forwards traffic between clients, that doesn't quite fit the term "peer to peer".

    • @commanderlegolas
      @commanderlegolas 5 місяців тому

      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

  • @ipianomidivisualizer121
    @ipianomidivisualizer121 2 роки тому

    Will it be possible to communicate Peer-To-Peer over the internet using Microcontrollers like ESP32 ?

  • @ayazalavi
    @ayazalavi 6 місяців тому

    what if router assign different ports than 50001 and 50002. In my case this is happening and I am unable to recevie messages

  • @dougphillips5686
    @dougphillips5686 Рік тому

    I would like to see an update using encryption

  • @soupnoodles
    @soupnoodles 4 місяці тому

    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?

  • @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 .

  • @ppacory
    @ppacory 9 місяців тому

    thks for this nice video, is there a source code for the rendezvous server ?

  • @cubeofmars291
    @cubeofmars291 3 роки тому

    What code editor do you use?

  • @tmsw7060
    @tmsw7060 3 роки тому

    Awesome I was waiting for this!

  • @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

  • @tchnque2234
    @tchnque2234 Рік тому

    what about tcp implementation?

  • @JulioCezar-bl5jt
    @JulioCezar-bl5jt 3 роки тому

    Does it work on different networks?

  • @Stoney_Eagle
    @Stoney_Eagle 3 роки тому

    Can you create a simple example for portless communication between NodeJS and React?

    • @xerrion
      @xerrion 3 роки тому +1

      You could use the BroadcastChannel from the web api, theres a npm package that integrates it into node.

  • @ThisIsLumpi
    @ThisIsLumpi 10 місяців тому

    Why did you write Client and Server? I thought a Peer To Peer connection doesn't have a server.

    • @dominykas5195
      @dominykas5195 9 місяців тому

      server just gives the clients their peers details

    • @ThisIsLumpi
      @ThisIsLumpi 9 місяців тому

      @@dominykas5195 ok, thx

  • @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 роки тому +1

      the rendezvous server is public(port forwarded) to accept the udp messages of the 2 clients .

  • @younginnovatorscenterofint8986

    how about peer-to-peer connection,able to get access to the other pc using python?

  • @El-Burrito
    @El-Burrito 3 роки тому

    Super awesome!

  • @garypaulson5202
    @garypaulson5202 2 роки тому

    Brilliant!

  • @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?

  • @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 роки тому +1

      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.

  • @aminghafoori6496
    @aminghafoori6496 3 роки тому

    i was waiting for this
    thanks

  • @soupnoodles
    @soupnoodles 4 місяці тому

    could you write the scripts from scratch? this is a bit hard to follow

  • @philtoa334
    @philtoa334 3 роки тому

    Nice.

  • @marcinziajkowski3870
    @marcinziajkowski3870 3 роки тому

    Thank u

  • @orestesom
    @orestesom 3 роки тому

    Next level of content men!

  • @roserosie4322
    @roserosie4322 2 роки тому

    Looking for peer to peer connection between two clients only

  • @sabinbaral4132
    @sabinbaral4132 3 роки тому

    Sir you are the best 🙏

  • @littleweenie9142
    @littleweenie9142 3 роки тому +1

    Hey, how do you edit multiple lines of code at once?

  • @otmanmouhib5220
    @otmanmouhib5220 2 роки тому

    why does it work with my private ip and not mu public ip !!!!!!!! HELP i m going nuts

  • @anthonyfuentes1179
    @anthonyfuentes1179 3 роки тому

    Imagine being the 1 guy that disliked the video

  • @Blasterxp
    @Blasterxp 2 роки тому

    Can this be blocked?

  • @melsonmascarenhas
    @melsonmascarenhas Рік тому

    This code will not work peer behind NAT.

  • @ahhdum64
    @ahhdum64 3 роки тому +2

    Woah, first view! Love the content!

    • @EngineerMan
      @EngineerMan  3 роки тому +1

      Nice work :)

    • @Andremzsptm
      @Andremzsptm 3 роки тому +1

      @@EngineerMan any plans to make some RabbitMQ content?

  • @xerrion
    @xerrion 3 роки тому

    I would tell you a joke. But you might not get it.

  • @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.