简体   繁体   中英

Bluetooth Connection with two devices (stream)

I develop a card game and want to pass different Objects, String to the connected device (Bluetooth) and back. The devices are connected. The question is: how is this possible? I tried with only strings: it worked, only one object (example: Card): worked, but if I try both at same time, the app crashes.

What exactly is crashed? Can you provide you code example, exception and stacktrace? It would be very helpful.

What can I suppose - if you can't access device concurrently you can use java monitors (synchronized keyword) to ensure that only one thread works with device at the same time. https://docs.oracle.com/javase/tutorial/essential/concurrency/sync.html can

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM