|
Boost : |
Subject: Re: [boost] How to access COM ports
From: master master (master_4_master_at_[hidden])
Date: 2009-01-04 20:57:40
Thank you,
Now my example is half done. I can open the COM port and write on it. But still I am tweaking with the response of COM port.
When I write to COM port data goes to attached device that works perfectly but then device returns the response. Response comes in the same stream, so I am reading the response from the same stream. The problem is that the response comes sometimes after 3 seconds, some times it comes after 5 seconds. If I read immediately then it reads the same data I send to COM port. Then I used threading and I force my program to sleep 3 or 5 seconds till the response comes and then read the data. Now it reads response correctly. But it does not read correctly every time. Now I am going to try two options 1. Do finer coding 2. Change the device.
Can anyone tell me how to add example in boost docs example. Because there are very few examples for asio; specially on serial port.
When my example will be complete I want to add it to BOOST documentation.
And yes! my portability issue is also solved. I do not need to use winsock or socket.h etc. Because Boost is itself portable, if I use Boost's library for networking then it will be automatically portable. Only we need to find out which library can serve our purpose.
Rahul
Boostian
To create something exceptional
________________________________
-Master4Master
"Confidentiality Warning: This message and any attachments are intended only for the use of the intended recipient(s), are confidential, and may be privileged. If you are not the intended recipient, you are hereby notified that any review, re-transmission, conversion to hard copy, copying, circulation or other use of this message and any attachments is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return email, and delete this message and any attachments from your system.
Virus Warning: Although I have taken reasonable precautions to ensure no viruses are present in this email, I cannot accept responsibility for any loss or damage arising from the use of this email or attachment."
Speak out for justice and peace,
even if your voice trembles.
________________________________
From: Giovanni Piero Deretta <gpderetta_at_[hidden]>
To: boost_at_[hidden]
Sent: Sunday, 4 January, 2009 9:21:40 PM
Subject: Re: [boost] How to access COM ports
On Sun, Jan 4, 2009 at 4:48 PM, Philippe Vaucher
<philippe.vaucher_at_[hidden]> wrote:
>> How to access COM port using BOOST library. I want to access COM3 port
>> using boost.
>>
>> I tried this
>> boost::asio::ip::tcp::resolver::query query("localhost", "COM3");
>
>
> COM ports aren't sockets. There's nothing in boost to support COM/serial
> ports yet.
Actually, yes. Boost.Asio does support serial ports:
http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio/overview/serial_ports.html
But I've never used this feature, so I can't really help.
--
gpd
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk