[ASIO] native back into local::stream_protocol
Hello List, I just need some guidance here. I have a parent process fork off a child and pass the int value to the child indicating what the native socket file descriptor it should use to receive communication from the parent process. I am just not able to get it placed back into a boost::asio::local::stream_protocol::socket object. Here is the code below, from the child process loaded via execlp: for(int i = 3; i < static_cast<unsigned char>(~0); i++) { if(i == boost::lexical_cast<int>(argv[0])) { continue; } close(i); } boost::asio::io_service io_service; boost::asio::local::stream_protocol::socket parent_(io_service); parent_.assign(boost::asio::local::stream_protocol, boost::lexical_cast<int>(argv[0])); Compiler error: g++ -c -g -MMD -MP -MF build/Debug/GNU-Linux-x86/main.o.d -o build/Debug/GNU-Linux-x86/main.o main.cpp main.cpp: In function ‘int main(int, char**)’: main.cpp:30: error: expected primary-expression before ‘,’ token Thank you, Etienne -- This message has been scanned for viruses and dangerous content by Pinpoint, and is believed to be clean.
Etienne Philip Pretorius
parent_.assign(boost::asio::local::stream_protocol, boost::lexical_cast<int>(argv[0]));
Compiler error: g++ -c -g -MMD -MP -MF build/Debug/GNU-Linux-x86/main.o.d -o build/Debug/GNU-Linux-x86/main.o main.cpp main.cpp: In function ‘int main(int, char**)’: main.cpp:30: error: expected primary-expression before ‘,’ token
stream_protocol is a type name. You cannot pass a type name as an argument to a function.
Christopher Yeleighton wrote:
Etienne Philip Pretorius
writes: parent_.assign(boost::asio::local::stream_protocol, boost::lexical_cast<int>(argv[0]));
Compiler error: g++ -c -g -MMD -MP -MF build/Debug/GNU-Linux-x86/main.o.d -o build/Debug/GNU-Linux-x86/main.o main.cpp main.cpp: In function ‘int main(int, char**)’: main.cpp:30: error: expected primary-expression before ‘,’ token
stream_protocol is a type name. You cannot pass a type name as an argument to a function.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users What would you use? I have tried stream_protocol::type...
Etienne Pretorius
Etienne Philip Pretorius
Christopher Yeleighton wrote:
Etienne Philip Pretorius
writes: parent_.assign(boost::asio::local::stream_protocol, boost::lexical_cast<int>(argv[0]));
What would you use? I have tried stream_protocol::type...
stream_protocol is a type name. You cannot pass a type name as an argument to a function. How about (stream_protocol ())? Chris
participants (2)
-
Christopher Yeleighton
-
Etienne Philip Pretorius