Re: [Bluez-devel] rfcomm bind : Address already in use

Marcel Holtmann
2004-07-09T18:13:11Z

Hi Tetsuo,

> I'm developing an application waiting for a RFCOMM connection, like following.
>
> - socket()
> - bind()
> - listen()
> - accept()
> :
> :
>
> I'm in trouble that bind() function fails saying "Address already in use".
>
> It occurs when waiting for RFCOMM connection from an only special corrupt peer
> once in awhile.
> It works fine to accept from almost peers using bluez, widcomm(for
> windows)and etc.
>
> The special corrupt peer sends RFCOMM frames like following sequence.
> (I attached the hcidump log)
>
> - RFCOMM_SABM
> - RFCOMM_PN
> - RFCOMM_DISC
> - RFCOMM_DISC
> - RFCOMM_DISC
> :
> repeat
> :
>
> Of course, it cannot establish a RFCOMM connection, so I disconnect the ACL
> connection using hcitool utility manually.
>
> And then I terminate the application, and see /proc/bluetooth/rfcomm information.
>
> ~ # cat /proc/bluetooth/rfcomm
> sk E6:D7:1E:96:A0:00 F3:78:51:CF:07:00 9 1
>
> Is it a garbage ???
> (Probably this causes me the trouble...)
>
> And I start the application, then the application fails to do bind()
> saying "Address already in use".
>
> So I need to reboot...
>
> I'm working to avoid rebooting in that matter, but cannot find a key to
> solve it yet.

what kind of peer is this? Why don't you try to fix the problem in the
peer device? The BlueZ RFCOMM part is working correct.

The left over socket you see in /proc is from your application and it is
in the closed state. Do you really terminate your application? Try to
repdroduce this with rctest.

Regards

Marcel

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net