Boost logo

Boost Users :

Subject: [Boost-users] [ASIO] native back into local::stream_protocol
From: Etienne Philip Pretorius (icewolfhunter_at_[hidden])
Date: 2010-04-28 18:59:10


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.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net