Waiting for Capnproto connection

Sorry I missed out part of my code that is important - I do use serve. How can I attempt to connect and retry?