wait for packet functionality implemented, connect is now a blocking method