File Transfer via Sockets in Python
Unlock all features
FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.
Unlock all features
FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.
Unlock all features
FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.
Unlock all features
FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.
Unlock all features
FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.
Related videos
Load Environment Variables From .env Files in Python
NeuralNine
100.4k views
Simple Bluetooth Chat in Python
NeuralNine
53.9k views
Google Sheets API Automation in Python
NeuralNine
103.6k views
Live Face Recognition in Python
NeuralNine
216.1k views
Use OpenAI's ChatGPT in Python
NeuralNine
117.7k views
Professional Expense Tracker in Python
NeuralNine
48.4k views
Working with YAML Files in Python
NeuralNine
57.1k views
Secure Login System in Python
NeuralNine
125.3k views
Backtesting Stock Trading Strategies in Python
NeuralNine
49.8k views
Simple Instagram Bot in Python
NeuralNine
92.9k views
Top Comments (10)
You are by far my favorite source for Python lessons. 1. You have a solid intro. 2. Your videos are not too long. 3. Even though the videos are not that long, you are clear on your explanation. Thank you for doing this.
I'm seeing verbatim copies of this code being used all over the place and it has to stop. This code is filled with unreliable constructs. It exhibits every python sockets' bad practice I've seen in the last 10+ years. 1) If you don't check the return value from send() that's a bug. You should be using sendall() for all the sends that you're not checking the return value of, which in this case is all of them. 2) Although perhaps not a big deal for this particular example, assuming that a fixed chunk of bytes like 1024 will end on a utf-8-encoded unicode character boundary is incorrect; 3) The biggest mistake is your assumption the every single send() or sendall() will be read by a single recv on the server side. That's not how tcp works and not how python SOCK_STREAM sockets work. If you send 1022 bytes in one send and 25 bytes in the next send, then on the server side you may receive 50 bytes in your first recv(1024) and then 100 bytes on you next recv(1024). Or you might receive 1024 bytes in your first recv(1024) but then only 1 byte in your next recv(1024). In your case, you might receive the file name, the file size, and a big chunk of the file itself in your first recv(1024) that you're assigning to the variable file_name. See the following answer on stack overflow for more details: https://stackoverflow.com/questions/43420075/python-socket-not-receiving-without-sending/43420503#43420503.
You've actually got so quality stuff on your channel. Keep that up man!
Thank you! I do like your inclusion of the progress bar!!
I love your videos Florian. Because, you always explain everything very easily in a short time period 😊😊😊
i am 70% sure that he recorded this video after break up. got the vibes
very informative. Not too brief but you get the concepts behind it.
Thank you! You just made my life easier next week!
Your channel is underrated
Honestly, I started watching your videos for the intro music. And stayed for the content.
Unlock the Data Inside
Turn Videos into Knowledge
- Get FREE 10/day: transcripts, summaries, chats
- Chat with videos, export text & PDF
- $1 free API credit for RAG, chatbots & research
Free forever plan • All features unlocked
Top Comments (10)
You are by far my favorite source for Python lessons. 1. You have a solid intro. 2. Your videos are not too long. 3. Even though the videos are not that long, you are clear on your explanation. Thank you for doing this.
I'm seeing verbatim copies of this code being used all over the place and it has to stop. This code is filled with unreliable constructs. It exhibits every python sockets' bad practice I've seen in the last 10+ years. 1) If you don't check the return value from send() that's a bug. You should be using sendall() for all the sends that you're not checking the return value of, which in this case is all of them. 2) Although perhaps not a big deal for this particular example, assuming that a fixed chunk of bytes like 1024 will end on a utf-8-encoded unicode character boundary is incorrect; 3) The biggest mistake is your assumption the every single send() or sendall() will be read by a single recv on the server side. That's not how tcp works and not how python SOCK_STREAM sockets work. If you send 1022 bytes in one send and 25 bytes in the next send, then on the server side you may receive 50 bytes in your first recv(1024) and then 100 bytes on you next recv(1024). Or you might receive 1024 bytes in your first recv(1024) but then only 1 byte in your next recv(1024). In your case, you might receive the file name, the file size, and a big chunk of the file itself in your first recv(1024) that you're assigning to the variable file_name. See the following answer on stack overflow for more details: https://stackoverflow.com/questions/43420075/python-socket-not-receiving-without-sending/43420503#43420503.
You've actually got so quality stuff on your channel. Keep that up man!
Thank you! I do like your inclusion of the progress bar!!
I love your videos Florian. Because, you always explain everything very easily in a short time period 😊😊😊
i am 70% sure that he recorded this video after break up. got the vibes
very informative. Not too brief but you get the concepts behind it.
Thank you! You just made my life easier next week!
Your channel is underrated
Honestly, I started watching your videos for the intro music. And stayed for the content.