Automaticly detect serial or network connection