Python Advanced Tutorial 6 – Networking

///Python Advanced Tutorial 6 – Networking

Python Advanced Tutorial 6 – Networking

FavoriteLoadingAdd to favorites

This is Tutorial covering how to set up TCP and UDP client/server models in python. I try to explain as simple as possible how everything comes together to allow our programs to communicate. All Links and Slides will be in the description. Subscribe for more cool stuff!

Slides & files – https://www.mediafire.com/folder/8mcihy2lglsuc/Tutorial_6_-_Networking

Python – http://python.org/

Ubuntu – http://www.ubuntu.com/

Facebook: https://www.facebook.com/DrapsTV

If you like what you see be sure to subscribe and thumbs up!

By |2017-05-01T12:23:39+00:00April 26th, 2017|Programming Video Tutorials, Python Video Tutorials|50 Comments

50 Comments

  1. Aditya S Rao April 26, 2017 at 9:14 pm - Reply

    really nice video 🙂 thanks for the help

  2. PunkSkaful April 26, 2017 at 9:14 pm - Reply

    I can hack nasa using this language

  3. aaron coleman April 26, 2017 at 9:18 pm - Reply

    def main():
    … host = ‘127.0.0.1’
    … port = 5000

    … s = socket.socket()
    … s.bind((host, port))

    … s.listen(1)
    … c, addr = s.accept()
    … print "Connection from: " str(addr)
    File "<stdin>", line 10
    print "Connection from: " str(addr)
    ^
    SyntaxError: invalid syntax
    >>>

  4. matthew basile April 26, 2017 at 9:18 pm - Reply

    if __name__ == "__main__":
    Main()

    I dont understand what this code is here for

  5. Sagun Kayastha April 26, 2017 at 9:21 pm - Reply

    Hello Draps, what should i put in the host ip when i want to connect between two different machine. for example me and my friends machine. Thank you

  6. MF&MM April 26, 2017 at 9:22 pm - Reply

    how to secure connection between client and server using ssl/tls ? really need your help.

  7. aaron coleman April 26, 2017 at 9:22 pm - Reply

    may i ask what version of python you’re using

  8. Micstape April 26, 2017 at 9:22 pm - Reply

    great, thanks for good explaining!

  9. Mohamed Farghali April 26, 2017 at 9:28 pm - Reply

    thank you man for nice and very useful tutorial

  10. lankyfingers April 26, 2017 at 9:29 pm - Reply

    "Welcome to Python advanced 6…" – Python Advanced #5 on screen lol.

  11. richa April 26, 2017 at 9:29 pm - Reply

    I want two hosts to send packets to each other.So, for this is socket programming the only option to exchange packets…plz hlp

  12. Anon Anonymous April 26, 2017 at 9:29 pm - Reply

    can you port forward so that way your server is avalable on a diffrent pc?

  13. science central April 26, 2017 at 9:31 pm - Reply

    Hey I need help cuz it’s coming up with ‘str’ object has no attribute ‘port’

  14. Vice Versa April 26, 2017 at 9:35 pm - Reply

    Thanks man I enjoyed the help

  15. shqiperia etnike April 26, 2017 at 9:37 pm - Reply

    thank yo so much for this tutorial.THANK YOU!!

  16. Destrica UK April 26, 2017 at 9:38 pm - Reply

    Can you make an updated version for python 3, because this has errors due to it not being able to send non bytes like objects

  17. imran sayeed April 26, 2017 at 9:41 pm - Reply

    Hello Draps.
    It is very informative and thanks for such a detailed explanation.
    I just wanted to know how can i server multiple clients, how can i send different data to multiple clients from server.
    kindly replay…

  18. VASTAUINE VIDEO April 26, 2017 at 9:41 pm - Reply

    When I create Server and Client on same local Host It Works.When I put Server Coad on Server (CPannel) it Does not Work.
    Following Error :TimeoutError: [WinError 10060]

  19. TeamWnJ - Survival n Shit April 26, 2017 at 9:41 pm - Reply

    I found that this doesn’t work with python 3.5;

    You’d have to replace raw_input with just input

    But then that means you’d be sending a string instead of bytes; leading to a TypeError that goes something along the lines of "bytes like object required, not str"

    Of course I’ve thought of encoding it, but then that would mean that the server would have to decode it

    Anybody have a good solution?

  20. MEDAGAM April 26, 2017 at 9:42 pm - Reply

    good to openly correcting bugs,

  21. Narcissistic Penguin April 26, 2017 at 9:42 pm - Reply

    I get a type error: ‘str’ does not support the buffer interface.

  22. Some Random Fellow April 26, 2017 at 9:42 pm - Reply

    I am making a python game that will require networking, but, as someone who primarily does java, i want to get used to python before i do anything too advanced. Would i be able to make the game first (say have each players controls on different parts of the keyboard), and _then_ putting in networking at the end? Or do i have to do the networking first so i dont make it too hard on myself later on down the road?

  23. sicnarfmismo April 26, 2017 at 9:43 pm - Reply

    can you change the host ip, other than localhost? like for example there is another pc connected in LAN.

  24. Mohan Pithani April 26, 2017 at 9:43 pm - Reply

    I’m trying to execute this in Python IDLE and the server runs good but when I run client I do not see the ip address in the first place. the cursor just blinks if I try to enter the details it gives me error. " invalid syntax"

  25. aaron coleman April 26, 2017 at 9:44 pm - Reply

    >>> import socket
    >>>
    … def main():
    … host = ‘127.0.0.1’
    … port = 5000

    … s = socket.scoket()
    … s.connect((host,port))

    … message = raw_input("->")
    … while message !=’q’:
    … s.send(message)
    … data = s.recv(1024)
    … print ‘Recieved from server: ‘ + str(data)
    … message = raw_input("->")
    … s.close()

    … if __name__ == ‘__main__’:
    File "<stdin>", line 17
    if __name__ == ‘__main__’:
    ^
    SyntaxError: invalid syntax
    >>> main()

  26. DaCurse0 April 26, 2017 at 9:44 pm - Reply

    tell me what is wrong with my code:
    hack compooter
    give daa to me

  27. Transform Yang April 26, 2017 at 9:45 pm - Reply

    thanks for your tutorial, I’m beginner, it helps me a lot, but I have questions:

    how can I use this from different computers, which means one computer as server, the others as clients.
    where codes do I need to change? (host ip and port? how can i get server’s ip and port?)

    looking forwarding to someone help me

    thanks

  28. son sun April 26, 2017 at 9:45 pm - Reply

    lovely job thanks for explain every think works good luck your life

  29. Denyse Huezo April 26, 2017 at 9:46 pm - Reply

    THANK YOUU !

  30. OBKwamz April 26, 2017 at 9:46 pm - Reply

    Im using a macbook and it tells me

    s.connect((host, port))
    ConnectionRefusedError: [Errno 61] Connection refused

    what should I do? please reply as soon as possible

  31. science central April 26, 2017 at 9:46 pm - Reply

    What is he using?

  32. Marcos April 26, 2017 at 9:48 pm - Reply

    how can i do same example with two pc or a pc and an android phone? thanks

  33. Chen dunzhi April 26, 2017 at 9:48 pm - Reply

    Thanks a lot, man.

  34. Tushar Sawhney April 26, 2017 at 9:50 pm - Reply

    It says ‘tuple’ has no attribute bind..Please help!!

  35. BrandNewByxor April 26, 2017 at 9:54 pm - Reply

    "terple"… Good video though, thanks

  36. cwbh10 April 26, 2017 at 9:56 pm - Reply

    tuple mate

  37. DLC ENERGY April 26, 2017 at 9:56 pm - Reply

    you’re telling me, you know networking in python. but you don’t know how to spell tuple?
    how can you even begin to pronounce "turple?" 3:31 damn! that’s mental…

  38. MerDjence April 26, 2017 at 9:58 pm - Reply

    Wait, why did you set the host as a loopback address, and why did it let you?

  39. aaron coleman April 26, 2017 at 9:59 pm - Reply

    I fixed it nvm ty

  40. Christian Rasmussen April 26, 2017 at 10:01 pm - Reply

    Great tutorial, great intro to networking. I’d like to give constructive critisism but I can’t find any. 🙁
    E: Oh yeah, make sure your code is error free, that was distracting. 🙂

  41. Tarun Goel April 26, 2017 at 10:03 pm - Reply

    awesome tutorial helping me a lot , thanks
    can you have networking chatting tutorial

  42. rastavibez007 April 26, 2017 at 10:05 pm - Reply

    thank you for your tutorials,

    i would like to make a VOIP client under python, will that be possible?
    thank you

  43. Ananth Narayan April 26, 2017 at 10:06 pm - Reply

    Great tutorial. However I am getting this error "error: [Errno 10053] An established connection was aborted by the software in your host machine"

  44. Vicky Patel April 26, 2017 at 10:07 pm - Reply

    can you can write same code of python IDLE and works or you have to do on terminal

  45. Arthur Watts April 26, 2017 at 10:07 pm - Reply

    I’ bailed when you misspelt ‘server’ on the first slide.

  46. Jokiez April 26, 2017 at 10:07 pm - Reply

    Underscoreunderscore

  47. Aditya S Rao April 26, 2017 at 10:08 pm - Reply

    do you play dota ? @drapsTV

  48. the queen eagle April 26, 2017 at 10:12 pm - Reply

    can i ask you whats is the version of python you use it ? is it 2.7.11 ?

  49. Saker Alabas April 26, 2017 at 10:13 pm - Reply

    Why do I have to put:

    If __name__ == ‘__main__’:
    Main()

    It doesn’t work for me

  50. Simon Herbicide April 26, 2017 at 10:13 pm - Reply

    This works perfectly! Thank you so much, you’re an excellent teacher

Leave A Comment

*