Sockets Tutorial with Python 3 part 1 – sending and receiving data


Welcome to a tutorial on sockets with Python 3. We have a lot to cover, so let’s just jump right in. The socket library is a part of the standard library, so you already have it.

Source code and text-based tutorial:

Channel membership:
Support the content:

#sockets #python #tutorial


Xem thêm bài viết khác:

34 thoughts on “Sockets Tutorial with Python 3 part 1 – sending and receiving data

  1. Hi, your lecture series was very helpful. But, I am stuck at a certain place in my server-client setup. The socket codes work well when both server and client are in the same network but I need to send data between machines not in the same network. I tried using the ip of the server machine(from ipconfig IPv4). But, the client can't connect to it. Could you help me fix the issue?

  2. HI I have some application which in written inside shell. i want to open that application using socket. How do i write code for opening adb shell using socket.

  3. it takes 2 3 hours of coding on c/c++
    Then you use python, and it is less than 5 minutes
    I guess on the python side, people don't really care how TCP works, how to convert host bytes to network bytes
    What is POXIS/BSD extra.
    on python, you just really type 10 lines of code, and you are done with it.

  4. I tried to run the files in cmd. But then it is saying that py -3.7 is not recognized as a command

  5. You should make one on how to do a P2P network. That'll be pretty useful, especially since it's pretty unreliable trying to host a big server on a regular PC. 🙂

  6. can somebody tell me why didnt it work when i launched it from the same dir i mean i have python 3.8 and used same terminal so what

  7. Hey man tyvm for the tutorials I wanted to share a bit of magic with you. I was sick of reopening cmd for testing and found a better way with a batch file.

    You can do this with or with out venv im sure. I just did mine in a venv.
    @echo off
    cmd /k "cd /d %~dp0venvscripts & activate & cd /d %~dp0 % &"

  8. I keep getting:
    s.bind((socket.gethostname(), 1234))

    OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted
    Anyone have any idea how to fix this?

  9. “And then an exclamation mark because this is serious business”
    I laughed my pants off hearing that😂

  10. 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??

  11. Hi! I have a socket connection into vpn connection (echo server) each 1 minute I send an echo message and the server answerme, the problem is after 6 hours this socket is closed alone, I dont have any code to close it an nothing, do you know if there is some code to dont allow disconnect?

  12. the client socket wont connect it gives-
    ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
    pls help

  13. How do you connect to a server that is not yours (ie not localhost). What if we wanted to connect to for example?

  14. I didn't check, but I think that there is an error in the program. If the server returns a string whose length is a multiple of the size of the received buffer, then there will most likely be a hang on the recv() line.

  15. 4:13 Come on man.. of course you don't send the message to the client through the main server socket object because it's intended for incoming connections and it does not contain the required destination info.
    In order to communicate with a specific client you need its address and port number (which is exactly what clientsocket variable is for) usually the server opens a thread for serving each client.

  16. I don't understand what's going on in this video. Can you give me a list of all the prerequisite knowledge except for python so i know what's going on in this video. I came here because of the Kivy tutorial, I wanted to understand what you meant by sockets. I understood the Kivy tutorial but i don't understand this one.
    Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *