API socket programming