Changed mainloop to a do while instead of while

Cannot bind to broadcast address