I want to have a server waiting for clients on port 5500 Then shift the communication to a separate thread and have the clienthandler thread do the communication with the client and have the main server thread free to listen to incoming clients.
I expect some heavy logic to be exercised in clienthandler which can keep the thread unresponsive for a few seconds, that is why I want the server thread freed of the workload and ready or new incoming client requests ( from different machines ) Again, I might be completely off with my understanding of ZMQ Thanks, Varol :) Martin Sustrik wrote: > Varol, > > >> zmq_msg_init (&query); >> zmq_recv ( pSocket, &query, 0 ); >> zmq_msg_close (&query); >> >> // How do I take the client connection here to a ZMQ_P2P in a new thread >> ? >> // Specify port 0 to bind(), and the OS will pick an unused port, >> // then use getsockname() to find out which port was chosen. >> ClientHandler *p = new ClientHandler; >> p->startThread ( ); >> > > What are you trying to do here? > > If what you want to do is to reply to the request, simply construct the > reply and send it back to the REP socket: > > zmq_send (pSocket, &reply); > > Martin > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
