Windows 10
Windows 10

Reputation: 1

It seems like socket.bind isn't in the socket module

Here is the error that it is showing

I use windows 7 running python 3.8.6. But it is showing that socket module does not have socket.bind.

Upvotes: 0

Views: 37

Answers (2)

batman is here
batman is here

Reputation: 31

you must create socket object first. then you can call socket.bind which state the 'socket' or 's' here as an object, as this example

import socket

HOST = ''                 # Symbolic name meaning all available interfaces
PORT = 50007              # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)

Upvotes: 1

Lê Tư Thành
Lê Tư Thành

Reputation: 1083

Try socket.socket.bind instead.

Or change import to from socket import socket

Upvotes: 0

Related Questions