Exemple #1
0
def test_ssdp_search_packet():
    msg = build_ssdp_search_packet(('239.255.255.250', 1900), 4, 'ssdp:all')
    assert msg == 'M-SEARCH * HTTP/1.1\r\n' \
           'HOST:239.255.255.250:1900\r\n' \
           'MAN:"ssdp:discover"\r\n' \
           'MX:4\r\n' \
           'ST:ssdp:all\r\n' \
           '\r\n'.encode()
def test_ssdp_search_packet_v6():
    """Test SSDP search packet generation."""
    msg = build_ssdp_search_packet(("FF02::C", 1900, 0, 2), 4, "ssdp:all")
    assert (msg == "M-SEARCH * HTTP/1.1\r\n"
            "HOST:[FF02::C%2]:1900\r\n"
            'MAN:"ssdp:discover"\r\n'
            "MX:4\r\n"
            "ST:ssdp:all\r\n"
            "\r\n".encode())
def test_ssdp_search_packet():
    """Test SSDP search packet generation."""
    msg = build_ssdp_search_packet(("239.255.255.250", 1900), 4, "ssdp:all")
    assert (msg == "M-SEARCH * HTTP/1.1\r\n"
            "HOST:239.255.255.250:1900\r\n"
            'MAN:"ssdp:discover"\r\n'
            "MX:4\r\n"
            "ST:ssdp:all\r\n"
            "\r\n".encode())
Exemple #4
0
 async def on_connect(transport: DatagramTransport) -> None:
     """Handle connection made."""
     packet = build_ssdp_search_packet(SSDP_TARGET, timeout, service_type)
     transport.sendto(packet, SSDP_TARGET)
Exemple #5
0
 async def on_connect(transport: DatagramTransport) -> None:
     """Handle connection made."""
     packet = build_ssdp_search_packet(target_data, timeout, service_type)
     _LOGGER.debug("Sending M-SEARCH packet")
     _LOGGER_TRAFFIC_SSDP.debug("Sending M-SEARCH packet: %s", packet)
     transport.sendto(packet, target)