you called connect(2) on a socket(2) twice, instead you should close(2) and recreate the socket(2) first.
One page links to EISCONN: