Serial port access is described at
http://msdn.microsoft.com/
and sample classes can be found at
http://www.codeguru.com/Cp
Main Topics
Browse All TopicsI am using Embbeded Visual C++ 4.0 to write an application on Pocket PC 2003 platform to communicate with another device via bluetooth serial port profile. I undestand that serial ports on PPC are Non Overlapped. I have to create a thread to read data and a thread to send the data. My problem is that my application can only send data once and then hangs. How do I synchronise the write thread and the receiving thread. is there any difference in using AfxBeginThread and CreateThread functions ? I also need to read all the data when it arrives in the receive buffer instead of reading it character by character and specificing the receive buffer size limit. How do I implement an event handler to do this ? I have not put any of my code because I have decided to start all over again. Could someone please help it's quite urgent.
Thanks
Panashe
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Serial port access is described at
http://msdn.microsoft.com/
and sample classes can be found at
http://www.codeguru.com/Cp
>> How do I synchronise the write thread and the receiving thread
You'd use a CRITICAL_SECTION to protect the data and e.g. an Event to signal 'data ready'
>>is there any difference in using AfxBeginThread and CreateThread functions ?
The 1st one is MFC-only and can handle CWinThread objects, that's the main difference.
Business Accounts
Answer for Membership
by: SteHPosted on 2004-11-25 at 08:18:00ID: 12675588
I would suggest to have only one thread which does all the communication with the serial port. The advantage of 2 threads for sending will be removed by the need of synchronising access to the serial port. My idea is to use an UI thread: threads.ht m
http://www.flounder.com/ui
and do the reading in the OnIdle of the CWinThread class and writing is done in a message handler.