Hegusung
Hegusung

Reputation: 21

Asynchronous raw socket in python 3.5

I was trying to use raw socket on python 3.5 in an asynchronous way.

I found the asyncore library where we can use raw sockets but it seems it has been deprecated and asyncio library is the way to go.

However after reading the documentation it seems asyncio doesn't support raw sockets.

Do you know other libraries or another way to achieve this goal ?

Upvotes: 2

Views: 2167

Answers (1)

Jashandeep Sohi
Jashandeep Sohi

Reputation: 5153

asyncio does provide a public API for raw sockets; however, it's probably better to use the Transport/Protocol abstraction in most cases.

The loop.sock_* coroutines implement the low-level socket operations. If you want even more control, you could watch the file descriptor for events and then read from the socket accordingly.

Upvotes: 3

Related Questions