Re: Socket bind failing with error -98

Marco Zunino <[email protected]> Wed, 8 Feb 2017 06:55:17 +0100
Newsgroups org.kernel.vger.linux-newbie,org.kernel.vger.lartc
Message-ID <CAP__gDnXq71G+b+8WEMC=E6C90QDfon_jhM-n4g=-FMKZmXnMg@mail.gmail.com>
http://man7.org/linux/man-pages/man7/socket.7.html

Assuming you are using AF_INET addresses, SO_REUSEADDR will not let
you bind() to an address if the same is already bound to an _active
listening socket_.

Also, SO_REUSEPORT option is required for all the socket that are
bound to the same address, maybe the address you are trying to bind()
to was already used by a socket that has no SO_REUSEPORT option set.

On Tue, Feb 7, 2017 at 7:27 PM, Suraj Choudhari
<[email protected]> wrote:
> Please share your thoughts about the problem.
>
> Thanks,
> Suraj
>
> On Tue, Feb 7, 2017 at 12:17 PM, Suraj Choudhari
> <[email protected]> wrote:
>> Hi experts,
>>
>> I am facing a problem while binding to TCP socket using bind()
>> function,  the problem is see for kernel versions >= 4.4.
>>
>> The bind() function is failing with error code -98.
>>
>> Currently i am calling bind() through a kernel thread.
>>
>> I searched similar errors and tried with 'setsockopt' with
>> 'SO_REUSEADDR' and 'SO_REUSEPORT ' flags.
>>
>> However, bind() still continues to fail with similar error.
>>
>> Can you please suggest if there are any other ways to fix it or any
>> particular debugging we shall do to analyze it ?
>>
>>
>> Thanks,
>> Suraj
> --
> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.linux-learn.org/faqs
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs