Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Linux Programming
  4. Using bluetooth connection asynchronously - C++

Using bluetooth connection asynchronously - C++

Scheduled Pinned Locked Moved Linux Programming
c++htmlsysadminlinuxquestion
2 Posts 2 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vaclav_
    wrote on last edited by
    #1

    Edit Since the server is in listen /accept waiting mode all I should worry about timeout. I can set the socket to take care of that. I just test client to send multiple single message - in 5 second interval and reinitialized the client socket each time. Works fine for my task. It has been a challenge , but I finally have bluetooth connection passing simple text message from client to server. My task is to be able to utilize such connection as necessary, hence not keeping it in any kinda-of synchronous loop. At present the communication will always be from client to server , and started by client. . Basically I am looking for a way to check "is server connected ? ". I do not see any issues closing the client socket and reinitializing it when new communication is required. I hope I can instruct server socket (timeout ?) to stay connected in "accept" function... However, I have been reading up on "select"

    select_tut(2) - Linux manual page[^]

    and wondering if that woudl be "cleaner" way to run this asynchronously by monitoring the state of the connection when necessary. Maybe I'll be over my head again using select... Any commentaries (to the subject) or other suggestion will be appreciated.

    E 1 Reply Last reply
    0
    • V Vaclav_

      Edit Since the server is in listen /accept waiting mode all I should worry about timeout. I can set the socket to take care of that. I just test client to send multiple single message - in 5 second interval and reinitialized the client socket each time. Works fine for my task. It has been a challenge , but I finally have bluetooth connection passing simple text message from client to server. My task is to be able to utilize such connection as necessary, hence not keeping it in any kinda-of synchronous loop. At present the communication will always be from client to server , and started by client. . Basically I am looking for a way to check "is server connected ? ". I do not see any issues closing the client socket and reinitializing it when new communication is required. I hope I can instruct server socket (timeout ?) to stay connected in "accept" function... However, I have been reading up on "select"

      select_tut(2) - Linux manual page[^]

      and wondering if that woudl be "cleaner" way to run this asynchronously by monitoring the state of the connection when necessary. Maybe I'll be over my head again using select... Any commentaries (to the subject) or other suggestion will be appreciated.

      E Offline
      E Offline
      Elen Grun
      wrote on last edited by
      #2

      It's time to travel, to learn, to experience new things. I am also [url=https://royalessays.co.uk/\]writing essays[/url] and studying extra books outside of class.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups