Handling TCP or UDP clients