Return-Path: Message-ID: From: "Albert Huang" To: bluez-devel@lists.sourceforge.net Subject: Re: [Bluez-devel] RFCOMM Server: accept does not block In-Reply-To: <9e3a30280602261729u52e8b48ap5a90d422e4ddc44@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_3424_9173638.1141006080994" References: <9e3a30280602261729u52e8b48ap5a90d422e4ddc44@mail.gmail.com> Sender: bluez-devel-admin@lists.sourceforge.net Errors-To: bluez-devel-admin@lists.sourceforge.net Reply-To: bluez-devel@lists.sourceforge.net List-Unsubscribe: , List-Id: BlueZ development List-Post: List-Help: List-Subscribe: , List-Archive: Date: Sun, 26 Feb 2006 21:08:00 -0500 ------=_Part_3424_9173638.1141006080994 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Use perror to find out what went wrong. http://beej.us/guide/bgnet/output/html/errnoman.html -albert On 2/26/06, Deniz Demir wrote: > > Hi, > > I want to run a small rfcomm server, however it does not block on > accept, and returns immediately with -1 as socket descriptor (last > line prints -1 right away). > > I have the following code: > > // allocate socket > s =3D socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); > > // bind socket to port 1 of the first available > // local bluetooth adapter > loc_addr.rc_family =3D AF_BLUETOOTH; > loc_addr.rc_bdaddr =3D *BDADDR_ANY; > loc_addr.rc_channel =3D (uint8_t) 1; > bind(s, (struct sockaddr *)&loc_addr, sizeof(loc_addr)); > > // put socket into listening mode > listen(s, 1); > > // accept one connection > client =3D accept(s, (struct sockaddr *)&rem_addr, &opt); > printf("client: %d \n", client); > > I expected it would block on accept function until a connection > request came in. I appreciate any comments. > > Thanks, > Deniz > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting > language > that extends applications into web and mobile media. Attend the live > webcast > and join the prime developer group breaking into this new coding > territory! > http://sel.as-us.falkag.net/sel?cmdlnk&kid=110944&bid$1720&dat=121642 > _______________________________________________ > Bluez-devel mailing list > Bluez-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bluez-devel > ------=_Part_3424_9173638.1141006080994 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Use perror to find out what went wrong.

http://bee= j.us/guide/bgnet/output/html/errnoman.html

-albert

On 2/26/06, Deniz Demir <= denizdemir@gmail.com> wrote:
Hi,

I want to run a small rfcomm server, however it does not block o= n
accept, and returns immediately with -1 as socket descriptor (last
= line prints -1 right away).

I have the following code:

 =    // allocate socket
    s =3D socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO= _RFCOMM);

    // bind socket to port 1 of the fi= rst available
    // local bluetooth adapter
&nbs= p;   loc_addr.rc_family =3D AF_BLUETOOTH;
  &nb= sp; loc_addr.rc_bdaddr =3D *BDADDR_ANY;
    loc_addr.rc_channel =3D (uint8_t) 1;
 &= nbsp;  bind(s, (struct sockaddr *)&loc_addr, sizeof(loc_addr)= );

    // put socket into listening mode
&nbs= p;   listen(s, 1);

    // accept = one connection
    client =3D accept(s, (struct sock= addr *)&rem_addr, &opt);
    printf("client: %d \n", client);
<= br>I expected it would block on accept function until a connection
reque= st came in. I appreciate any comments.

Thanks,
Deniz


-= ------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting lang= uage
that extends applications into web and mobile media. Attend the liv= e webcast
and join the prime developer group breaking into this new codi= ng territory!
http://sel.as-us.falkag.net/sel?cmdlnk&kid=11094= 4&bid$1720&dat=121642
______________________________________= _________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/= lists/listinfo/bluez-devel

------=_Part_3424_9173638.1141006080994-- ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel