Skip to content

TypeError while using socket.bind() #744

@ziGuy

Description

@ziGuy

Hello,
I'm trying to code a webserver using usocket lib but got the following issue.
Can you please guide me to fix this issue? is it a bug?

My environment:

micropython -v
MicroPython v1.19.1-859-g41ed01f13 on 2023-02-13; linux [GCC 6.3.0] version

This happens as well on my esp32 device, which i believe running micropython 1.20

My code:

import usocket as socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('0.0.0.0', 80))

Traceback:

Traceback (most recent call last):
  File "boot.py", line 4, in <module>
TypeError: object with buffer protocol required

Edit:

  • I've tried with latest micropython and issue still occurs:
    MicroPython v1.20.0-544-g977dc9a36 on 2023-10-02; linux [GCC 6.3.0] version
  • Replacing bind function with the following didn't help:
    s.bind((b'0.0.0.0', 80))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions