public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [Bluez-devel] rfcomm socket and rfcomm tty
@ 2005-01-03 18:49 omap
  2005-01-03 18:54 ` Marcel Holtmann
  0 siblings, 1 reply; 14+ messages in thread
From: omap @ 2005-01-03 18:49 UTC (permalink / raw)
  To: bluez-devel


Hi Marcel,

First of all i would like to say
thanks for you previuos help. Well, I
am having problems on RFCOMM socket too.

		if (bind(sock, (struct sockaddr
*)&addr, alen) < 0)  {
   			perror("bind");
    		exit(1);
		}

can you tell me if there is anything
wrong is this code? I got a run time
error that says

bind:Socket operation on non socket



> Hi Mike,
> 
> >     Is it mean that rfcomm socket
can not connect to a rfcomm tty?
> >     If the answer is yes, Does it
mean that all program base on bluez 
> > should use rfcomm tty to connect
to bluetooth Serial Port profile?
> 
> you can use RFCOMM socket or RFCOMM
TTY to connect to the serial port
> profile. Nothing matters and
actually you can convert a socket into a
> TTY if it is needed later. However
if you don't need a TTY for legacy
> reasons then always use the RFCOMM
socket, because this will be much
> cleaner and easier.
> 
> Regards
> 
> Marcel
> 
> 
> 
> 
>
-------------------------------------------------------
> The SF.Net email is sponsored by:
Beat the post-holiday blues
> Get a FREE limited edition
SourceForge.net t-shirt from ThinkGeek.
> It's fun and FREE -- well,
almost....http://www.thinkgeek.com/sfshirt
>
_______________________________________________
> Bluez-devel mailing list
> Bluez-devel@lists.sourceforge.net
>
https://lists.sourceforge.net/lists/listinfo/bluez-devel
> =0A =0A________________________________________________________________=
__________=0AAcabe com aquelas janelinhas que pulam na sua tela.=0AAntiPo=
p-up UOL - =C9 gr=E1tis!=0Ahttp://antipopup.uol.com.br/=0A



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: [Bluez-devel] rfcomm socket and rfcomm tty
@ 2005-01-03 19:12 omap
  2005-01-03 19:52 ` Marcel Holtmann
  0 siblings, 1 reply; 14+ messages in thread
From: omap @ 2005-01-03 19:12 UTC (permalink / raw)
  To: bluez-devel


Hi Marcel, this is the complete code

int main(void)
{
		int sock, client, alen;
		struct sockaddr_rc addr;

		if (sock =3D socket(AF_BLUETOOTH,
SOCK_STREAM, BTPROTO_RFCOMM) < 0) {
 				perror("socket");
 				exit(1);
  		}

		addr.rc_family =3D AF_BLUETOOTH;
		bacpy(&addr.rc_bdaddr, BDADDR_ANY);
		addr.rc_channel =3D htobs(CHANNEL);
		alen =3D sizeof(addr);
 		
		
			if (bind(sock, (struct sockaddr
*)&addr, alen) < 0)  {
				perror("bind");
				exit(1);
			}

		listen(sock,QUEUE);
		printf("Waiting for
connections...\n\n");
		while(client =3D accept(sock, (struct
sockaddr *)&addr, &alen)) {
    		printf("Got a connection
attempt!\n");
			close(client);
		}

		close(sock);
		return 0;
}



> Hi,
> 
> > First of all i would like to say
> > thanks for you previuos help. Well, I
> > am having problems on RFCOMM
socket too.
> > 
> > 		if (bind(sock, (struct sockaddr
> > *)&addr, alen) < 0)  {
> >    			perror("bind");
> >     		exit(1);
> > 		}
> > 
> > can you tell me if there is anything
> > wrong is this code? I got a run time
> > error that says
> > 
> > bind:Socket operation on non socket
> 
> this code as-is looks correct, but
the context is missing. Show us the
> complete function.
> 
> Regards
> 
> Marcel
> 
> 
> 
> 
>
-------------------------------------------------------
> The SF.Net email is sponsored by:
Beat the post-holiday blues
> Get a FREE limited edition
SourceForge.net t-shirt from ThinkGeek.
> It's fun and FREE -- well,
almost....http://www.thinkgeek.com/sfshirt
>
_______________________________________________
> Bluez-devel mailing list
> Bluez-devel@lists.sourceforge.net
>
https://lists.sourceforge.net/lists/listinfo/bluez-devel
> =0A =0A________________________________________________________________=
__________=0AAcabe com aquelas janelinhas que pulam na sua tela.=0AAntiPo=
p-up UOL - =C9 gr=E1tis!=0Ahttp://antipopup.uol.com.br/=0A



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread
* [Bluez-devel] rfcomm socket and rfcomm tty
@ 2004-12-28  9:03 mike
  2004-12-29 10:25 ` Marcel Holtmann
  0 siblings, 1 reply; 14+ messages in thread
From: mike @ 2004-12-28  9:03 UTC (permalink / raw)
  To: bluez-devel

Dear all

    I have little knowledge on tty structure, so i want to clarify 
something is that, if i want to connect to a rfcomm enabled phone. Are 
there any difference when i sending raw data to the phone with tty 
rfcomm and socket rfcomm? I ask this question because i see that from 
bluez-util rfcomm source code, tty connection is built up from socket 
first and then set the tty attr. So if i do not need tty functions, only 
read/write from/to external device is needed, socket rfcomm will be more 
simple. Am i right?

    If i make any thing wrong, please tell me.
    Thanks

Mike,Lee


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2005-01-05 11:39 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-03 18:49 [Bluez-devel] rfcomm socket and rfcomm tty omap
2005-01-03 18:54 ` Marcel Holtmann
  -- strict thread matches above, loose matches on Subject: below --
2005-01-03 19:12 omap
2005-01-03 19:52 ` Marcel Holtmann
2004-12-28  9:03 mike
2004-12-29 10:25 ` Marcel Holtmann
2004-12-30  1:55   ` mike
2005-01-01 18:42     ` Marcel Holtmann
2005-01-03  7:15       ` mike
2005-01-03  9:51         ` Marcel Holtmann
2005-01-04  7:32           ` mike
2005-01-04 11:51             ` Marcel Holtmann
2005-01-05  8:15               ` mike
2005-01-05 11:39                 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox