Python 3 Programming Tutorial - Sockets Binding and listening

preview_player
Показать описание
In this Python 3 and sockets tutorial, we cover how to bind and listen with sockets on a specific port.

Bitcoin donations: 1GV7srgR4NJx4vrk7avCmmVQQrqmv87ty6
Рекомендации по теме
Комментарии
Автор

When I watch a Python tutorial, It's yours! I never had to go to another channel for tutorial videos!!! You're amazing!

EvdeKsp
Автор

Your videos are awesome, I can finally understand with ease how to do these things, all other guides I've found on the internet are either unclear or just tell you to copy paste a command, and that is like cheating in school, you'll get good grades but you won't learn.

adrianotironi
Автор

For those using linux, "nc" (netcat) can be used in place of telnet... it also has some powerful features itself for setting up a listening server besides :) .

maxlee
Автор

Thanks for the tutorials! Your guides are way more detailed than my online course hahahaha... ohhh I would have been screwed without you!

avengers
Автор

So s.listen(5) accepts up to 5 scans right? How do you monitor that port until you stop the program?

jaimedpcaus
Автор

i have trouble using python3 socket for file transfer like image, mp3(decode error)
can you please make a video on file transfer

Deepakkumar-tqxv
Автор

So really, what you just did correct me if I'm wrong is you setup a simple local server that accepts communication on port 5555 and you used your command window to connect to your local server (your machine's port 5555). I'm learning this in a networks class so I'm still a newbie. 

maresfillies
Автор

could you explain this line: conn, adr = s.accept()?

computerscientist
Автор

Ok, i've connected to localhost but my terminal shows nothing. What to do next?

jeromedeleon
Автор

I'm semi new to python and i have a question.

print('connected to: '+ addr[0] + ':'+ str(addr[1]))

what is addr[1]?

I know addr[0] is the IP (1. how did it get the IP?)
2. but what are the numbers after the colon?

3. is addr getting its info from the try function, in s.bind((host, port)) ?

4. why do we have the host variable if we dont use it?

thanks

KittenCorner
Автор

Even after commenting out the system that lets me know there is an error it tells me that s is an invalid syntax even though it is clearly defined

tristanbouchard
Автор

how do you connect to this from a separate machine? I tried using it from another machine and it didn't work then. Any help would be appreciated

superdan
Автор

It's a Q! No, it's a cue! No... it's a queue, of course! D'oh I haven't go a clue.

kebman
Автор

Really liked your tutorial. Could you continue this topic with two client communicating? or is it possible? either 1:1 or 1:many

ronelcabrera
Автор

Hey, it works like a charm ... but - what exactly is it?

Did we just simulate a client and a server "conversation"? We gave ourselves a port, waited/listened for a connection, and then from the terminal also connected to ourselves?

And when exactly is this useful?

RealMcDudu
Автор

Except: socket.error as e: but my python claims that as is an invalid syntax

tristanbouchard
Автор

hey is it something like this:
socket firsts bind to the host the listen for the connection and when it connects it ends.
PS:
what is that s.accept()?

marvy-lol
Автор

if I wanna connect to another URL and always listen if this URL is checked will do something
i can do it with this way with socket right?

ahmedhelmy
Автор

when i printed
print(conn), the output was
socket.socket fd=584, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 5555), raddr=('127.0.0.1', 58151)>
can u plz xplain laddr and raddr
and also the argument (5) written after listen

soumyadeepmandal
Автор

Hi sentdex, Thanks for the tutorials and as I am new to socket programming I need to know more about sockets from the scratch...could you  please tell me  which material to refer for more info on socket programming in python..??
And one more thing, is it mandatory to have this statement "s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)"
in all  socket programming ??

nandishrao