         else
           sendDataByTCP client.socket, client.videoTCPDataChannel, rtpBuffer
       else
-        videoRTPSocket.send rtpBuffer, 0, rtpBuffer.length, client.clientVideoRTPPort, client.ip, (err, bytes) ->
-          if err
-            console.log "[videoRTPSend] error: #{err.message}"
+        if client.clientVideoRTPPort?
+          videoRTPSocket.send rtpBuffer, 0, rtpBuffer.length, client.clientVideoRTPPort, client.ip, (err, bytes) ->
+            if err
+              console.log "[videoRTPSend] error: #{err.message}"
   return
 
 sendVideoPacketAsSingleNALUnit = (nalUnit, timestamp) ->

    else
      sendDataByTCP client.socket, client.audioTCPControlChannel, buf
  else
    audioRTCPSocket.send buf, 0, buf.length, client.clientAudioRTCPPort, client.ip, (err, bytes) ->
      if err
        console.error "[audioRTCPSend] error: #{err.message}"

stopSendingRTCP = (client) ->
  if client.timeoutID?

          else
            sendDataByTCP client.socket, client.audioTCPDataChannel, rtpBuffer
        else
          if client.clientAudioRTPPort?
            audioRTPSocket.send rtpBuffer, 0, rtpBuffer.length, client.clientAudioRTPPort, client.ip, (err, bytes) ->
              if err
                console.error "[audioRTPSend] error: #{err.message}"
  return

pad = (digits, n) ->
