How to access COM ports

How to access COM port using BOOST library. I want to access COM3 port using boost. For socket port the below line works .... ........ boost::asio::ip::tcp::resolver::query query("localhost", "9999"); .......... ..... but how to do it for COM port I tried this .... ....... boost::asio::ip::tcp::resolver::query query("localhost", "COM3"); ......... ....... but it didn't worked. Another problem I am facing is that the network client should be platform-independent but if I use socket.h then it will not work on windows and if I use winsock then it will not run on linux/unix variants. Same for other header files like inet.h etc Rahul 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. Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/

boost::asio::ip::tcp::resolver::query query("localhost", "9999"); ......... .....
but how to do it for COM port
I never tried it, but it seems that you just pass your com-port name to serial_port object, like this: // UNTESTED io_service io; serial_port port(io, "com1); or: serial_port port(io); port.open("com1");

Thank youIgor. I will try it today. How to add new example to boost lib docs. If I got success I want to add serial port example to asio lib because it is lacking with the examples. Rahul Boostian :) Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/

How to access COM port using BOOST library. I want to access COM3 port using boost.
Use the Asio serial port facilities. COM / serial ports are not TCP streams. Read the Asio reference doc on Serial port facilities (I don't think there's any serial port examples in the docs yet, but there should be people on this or the Asio e-mail list that can help with specific questions).
Another problem I am facing is that the network client should be platform-independent but if I use socket.h then it will not work on windows and if I use winsock then it will not run on linux/unix variants. Same for other header files like inet.h etc
Don't use them. Everything you need (unless you're doing something very esoteric) is supplied through the Asio facilities. Are you confusing COM / serial I/O with networking programming? They are two separate and distinct things, although Asio provides an API to handle async events on either. Cliff

Thank You Cliff Green for making the concept clear ( specially for platform-independent). Today is sunday so now i can work on it.
I got this help from docs, and I hope it will help me.
http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio/overview/serial_por...
Thank you
Rahul
________________________________
From: Cliff Green
How to access COM port using BOOST library. I want to access COM3 port using boost.
Use the Asio serial port facilities. COM / serial ports are not TCP streams. Read the Asio reference doc on Serial port facilities (I don't think there's any serial port examples in the docs yet, but there should be people on this or the Asio e-mail list that can help with specific questions).
Another problem I am facing is that the network client should be platform-independent but if I use socket.h then it will not work on windows and if I use winsock then it will not run on linux/unix variants. Same for other header files like inet.h etc
Don't use them. Everything you need (unless you're doing something very esoteric) is supplied through the Asio facilities. Are you confusing COM / serial I/O with networking programming? They are two separate and distinct things, although Asio provides an API to handle async events on either. Cliff Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/
participants (3)
-
Cliff Green
-
Igor R
-
master master