Python Intermediate Tutorial #7 - Sockets and Network Programming

preview_player
Показать описание
In today's episode, we are talking about sockets and network programming.

Subscribe and Like for more free content!
Рекомендации по теме
Комментарии
Автор

by far one of the most underrated channels out there, i hope you can pop off soon and get what you deserve

bassemgouty
Автор

The things you explain reminds me of techwithtim explanations. I don't know if you are aware of him but I like content of both of you now. Keep going with more videos!

kaustubhgupta
Автор

Just to point out that the printed port 51390 is NOT wrong. It is the source port of the client that initiated the connection. In other words the connection is from client:51930 to . If you run the program multiple times you should get different ports most almost every time..

dimitrioschatzidimitriou
Автор

best channel i found in my entire life

kulrajchavda
Автор

If you're running the server on a machine outside of your LAN, like a VServer, you have to use the PUBLIC IP of the remote machine as the HOST. Alternatively, if the remote machine only has one connection to the outside, you can use server.bind(('', PORT)) to bind to all available IP addresses. '' Is two single quotes but the youtube font makes it hard to read.

Took me an afternoon to figure that out ':D

--ACCEPT--
Автор

I am not able to open python file using IDLE on my Windows 7 machine on clicking on Edit with IDLE in context menu. It instead creates a __pycache__ folder on desktop. Why is that so ?

mcbotface
Автор

I did this with threading to test if I remember all, had to use event wait due to them basically starting synchronized and gad to go back to check one again really important to do own stuff while watching

therealchicken
Автор

What about a client.shutdown()? I know it's automatic in Python, but I think it's a good practice to do that anyways.

jansz
Автор

I am getting the following error:
OSError: [WinError 10049] The requested address is not valid in its context

Can somebody provide me with a solution?

rohitdeosthale
Автор

11:33 It's no surprise as the port is already taken by the server. Your socket basically picked a random free port.

jansz
Автор

if you have this this kind of error:
[WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted

write the second line on server socket code below:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

then it worked.

MrTroy
Автор

how do i solve this error?
Traceback (most recent call last):
File "D:/IVAN VIRTUAL CLASS FILES/python programming/chatbox related/client.py", line 4, in <module>
s.connect(('127.0.0.1',
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

ivanchristopheracal
Автор

I keep getting the error: ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

Do you need to have anything else running or specially configured for this to work?

sewrough
Автор

Great tutorial just one thing, It's not a good idea to name your server file as "socket.py" as it can cause problem with namespaces.

romankazi