DoumanAsh/wpa-ctrl

open wlan0 failed:Address already in use (os error 98)

Closed this issue · 2 comments

The problem is useless the first time it is used, but an error is reported after a period of time:
Address already in use (os error 98)

Is it? The connection is not released?

image

I'm not sure I understand what you're doing

I assume you're getting this error when you call open

Note that this is not regular file open
The way it works is that it creates local file to bind to here
https://github.com/DoumanAsh/wpa-ctrl/blob/master/src/lib.rs#L617

So if you run multiple instances of the same program it would fail due to how I generate local socket name
https://github.com/DoumanAsh/wpa-ctrl/blob/master/src/lib.rs#L87

Do you have multiple instances running?
I can introduce parameter to customize local socket name I guess

I created idea for customizing how socket name generated
Can you please try to use this patch?

You can implement SuffixGenerator trait to control how this library generates local socket name
But I also added syscall to remove socket before attempting to bind unix socket

#3