Update main.js

Fixing the issue where the port number is overwritten with handleSelect() function even though there was a successful connection before.
Merge pull request #38 from hcancelik/patch-1

Update main.js