connect() has an optional parameter. Perhaps you should use it. But keep in mind that the receiving thread must be running an "event loop" or nothing will happen.