Python Network Programming #2: Server-Client Connection

preview_player
Показать описание
In this quick 9 minutes tutorial you will learn how to create a connection between a server that you create and one or multiple clients.
We need to know first a few things about the server.

First, the server has a bind() method which binds to a specific ip and port so it can listen to incoming requests.

Second, the server has a Listen() method which puts the server into a listen mode which allows the server to listen to
incoming connections.

Last we have accept and close() methods.
accept() : intiates a connection with the client.
close() : closes the connection with the client.

Рекомендации по теме
Комментарии
Автор

Just a side note about telnet command - If you are working on Microsoft Windows, the telnet client is disabled by default so you need to activate it.
First, open your control panel -> Programs -> Programs and features -> on the left side click on Turn Windows features on or off -> Check the telnet client box, and you will be all set.

BekBrace
Автор

Hi, I really enjoyed watching your you do a very good job explaining the process. Thanks

adegbolaige
Автор

Sir, is there any way using C code to discover all the dhcp server in our network
C program to identify Dhcp server in a lan ???
Kindly help!

viratsati
Автор

great video tutorial! are you looking to make more in depth client-server and network related python videos?

kairen
Автор

I got this error. s.connect((host, port)) ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it. How do I fix it?

frankopokukoduah
Автор

Thank you so much for the video, i had a quick question. I was able to connect the server and client; however i am supposed to have a mini remot home management. So for example the server will display light switch of the living room to be on or off and as a client i need to check the status and am able to update it to be off or on. How would you suggest i move forward with this after the basic connection of server and client? I have been lost for a couple of days in searching for guidance. Thank you!

leovargas
Автор

Hi. If I wanted to establish a connection between a server and a client that are not on the same network (i.e. i'm hosting the server from my house and my friend is the client from her house), how would I do that? Thanks.

hails
Автор

Hallo Brace.
Great work taking zour time to explain the differents keywords.
at line 10 in your code why do we have two variables c and addr on the left and set them equal to s.accept()? Please clarify on that.
i have just smashed the liked button
Thank you

blaisofotso
Автор

Brother is there any way using python code to know all the dhcp servers connected to our machine or network
To know all the dhcp servers when we are connected to lan

viratsati
Автор

Hey link for this python software please

GurlalSingh-mbfg
Автор

Port number can be given anything??? It is not specified or wt??

Dhavanakarthik
Автор

Can this also connect two different devices

surajp
Автор

how can i print (the client is disconnected) if the client disconnected

sexyunix
Автор

The telnet command isn't working for me at all. Anyone else experiencing this?

*edit* nevermind i got it working, had to enable telnet :p

not_vnix
Автор

How can we transfer files from client.py to server.py

dontreadthis
Автор

Hey hope you are doing alright just I wanna say that
GOD loved the world so much he sent his only begotten
son Jesus to die a brutal death for us so that we can have eternal life and we can all accept this amazing gift this by simply trusting in Jesus, confessing that GOD raised him from the dead, turning away from your sins and forming a relationship with GOD.

zstar