I created a socket with BOOST asio and I use it in a server process that accepts connections from "remote" client. It is possible from the process that created the socket, send data to the same socket simulating the arrival of data from a client process? -- View this message in context: http://boost.2283326.n4.nabble.com/ASIO-Send-data-on-a-socket-tp3738099p3738... Sent from the Boost - Users mailing list archive at Nabble.com.
I created a socket with BOOST asio and I use it in a server process that accepts connections from "remote" client. It is possible from the process that created the socket, send data to the same socket simulating the arrival of data from a client process?
To the same socket - you can send data back to your client. To simulate data arrival, you have to connect another socket to the port that the listening socket listens on, but this second socket can reside in the same process.
My process uses two threads, a parent thread and a child thread. The parent thread make a socket server and when a connection request arrives, it creates the child thread which uses this socket to communicate with the client. My intention was to send commands from the parent thread to child (for its termination) using the this socket... (I use the C++2011 thread that not allow the thread killing) -- View this message in context: http://boost.2283326.n4.nabble.com/ASIO-Send-data-on-a-socket-tp3738099p3739... Sent from the Boost - Users mailing list archive at Nabble.com.
Hi,
My process uses two threads, a parent thread and a child thread.
The parent thread make a socket server and when a connection request arrives, it creates the child thread which uses this socket to communicate with the client.
My intention was to send commands from the parent thread to child (for its termination) using the this socket...
(I use the C++2011 thread that not allow the thread killing)
Just close the socket from the parent thread, client-thread operations on this socket will fail and throw. You can just terminate the thread if such an error occurs. HTH michi7x7
participants (3)
-
Claude
-
Igor R
-
michi7x7