sync codes from original fastsocket