It looks like there are 3 problems with this.
The main one is you need to call poller.poll()
as the first thing inside the while
loop. This is why you are not getting any messages.
The next issue is that you're checking the same index for both sockets: I expect the second if
statement needs to be
if(poller.pollin(1))
Lastly, the req socket requires a send before every receive, so the call to send needs to be inside the while loop, and before the poller.poll()
you just added above :)