/** * send an EPP frame to the remote peer * @param resource $socket a socket connected to the remote peer * @param string $xml the XML to send * @throws Exception when it doesn't complete the write to the socket * @return the amount of bytes written to the frame */ static function sendFrame($socket, $xml) { // Grab XML length & add on 4 bytes for the counter $length = strlen($xml) + 4; $res = Net_EPP_Protocol::_fwrite_nb($socket, pack('N', $length) . $xml, $length); // Check our write matches if ($length != $res) { throw new Exception("Short write when sending XML"); } return $res; }