Linux bluetooth development
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: bluez-users@lists.sourceforge.net
Subject: Re: [Bluez-users] reconnect if a remote device quits
Date: Sat, 16 Apr 2005 01:21:15 +0200	[thread overview]
Message-ID: <1113607275.16433.44.camel@pegasus> (raw)
In-Reply-To: <4260015E.1090104@gmx.ch>

Hi Marco,

> I connect from a PC to another like this:
> sock = socket(...)
> bind(sock, ...)
> connect(sock, ...)
> // here the data is exchanged
> 
> 
> I now wish to automatic reconnect if the other PC closes the connection 
> (reboot for example), so I do:
> 
> while(true)
> {
> 	sock = socket(...)
> 	bind(sock, ...)
> 	connect(sock, ...)
> 	// here the data is exchanged until the remote device quits
> 	sleep(a little);
> }
> 
> this works fine. but actually i expected this to be enough:
> 
> sock = socket(...)
> bind(sock, ...)
> while(true)
> {
> 	connect(sock, ...)
> 	// here the data is exchanged
> 	sleep(a little);
> }
> 
> but this won't reconnect...
> why is socket() and bind() required again? don't they stay the same if I 
> try to connect to the same bluetooth device again?

you need to do the full stuff, because close() means closed.

Regards

Marcel




-------------------------------------------------------
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://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

      reply	other threads:[~2005-04-15 23:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-15 18:01 [Bluez-users] reconnect if a remote device quits Marco Trudel
2005-04-15 23:21 ` Marcel Holtmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1113607275.16433.44.camel@pegasus \
    --to=marcel@holtmann.org \
    --cc=bluez-users@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox