app/client.rb
def udpSocket(sock, didReceiveData:data, fromAddress: address, withFilterContext:tag)
    address_host = GCDAsyncUdpSocket.hostFromAddress(address)

    unless @accepted_host
      @accepted_host = address_host
      logger.debug{"@accepted_host => #{@accepted_host}".ascii_cyan_bg}
    end

    if address_host == @accepted_host
      data_str = "#{data}"

      if data_str.index('tm|') == 0
        packet = TimingPacket.parse(data_str)
        packet.received_ms = Time.now_ms
        on_timing_packet(packet)
      else
        @delegate.on_received_broadcast(data_str, address_host)
      end
    end
  end
#  /**
#   * Called when the socket has received the requested datagram.
#   **/
#  - (void)udpSocket:(GCDAsyncUdpSocket *)sock didReceiveData:(NSData *)data
#     fromAddress:(NSData *)address
#     withFilterContext:(id)filterContext;
Called when the socket has received the requested datagram.
Called when the socket has received the requested datagram .
def udpSocket(sock, didReceiveData:data, fromAddress: address, withFilterContext:tag)
    address_host = GCDAsyncUdpSocket.hostFromAddress(address)
    unless @accepted_host
      @accepted_host = address_host
      logger.debug{"@accepted_host => #{@accepted_host}".ascii_cyan_bg}
    end
    if address_host == @accepted_host
      data_str = "#{data}"
      if data_str.index('tm|') == 0
        packet = TimingPacket.parse(data_str)
        packet.received_ms = Time.now_ms
        on_timing_packet(packet)
      else
        @delegate.on_received_broadcast(data_str, address_host)
      end
    end
  end
def udpSocket ( sock , didReceiveData : data , fromAddress : address , withFilterContext : tag ) address_host = GCDAsyncUdpSocket . hostFromAddress ( address ) unless @accepted_host @accepted_host = address_host logger . debug { "@accepted_host => #{@accepted_host}" . ascii_cyan_bg } end if address_host == @accepted_host data_str = "#{data}" if data_str . index ( 'tm|' ) == 0 packet = TimingPacket . parse ( data_str ) packet . received_ms = Time . now_ms on_timing_packet ( packet ) else @delegate . on_received_broadcast ( data_str , address_host ) end end end
Called when the socket has received the requested datagram.
Called when the socket has received the requested datagram .
sock
didReceiveData
data
fromAddress
address
withFilterContext
tag