Moved sending of TCP and UDP messages into AsyncTask to avoid NetworkOnMainThreadException