socket: implement assignment operator

Avoids shallow copies which were causing segmentation faults in CCRTP (see https://github.com/dyfet/ccrtp/issues/16)