File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -389,3 +389,30 @@ def test_get_service_info_failure_path():
389389 zc = Zeroconf (interfaces = ['127.0.0.1' ])
390390 assert zc .get_service_info ("_neverused._tcp.local." , "xneverused._neverused._tcp.local." , 10 ) is None
391391 zc .close ()
392+
393+
394+ def test_sending_unicast ():
395+ """Test sending unicast response."""
396+ zc = Zeroconf (interfaces = ['127.0.0.1' ])
397+ generated = r .DNSOutgoing (const ._FLAGS_QR_RESPONSE )
398+ entry = r .DNSText (
399+ "didnotcrashincoming._crash._tcp.local." ,
400+ const ._TYPE_TXT ,
401+ const ._CLASS_IN | const ._CLASS_UNIQUE ,
402+ 500 ,
403+ b'path=/~paulsm/' ,
404+ )
405+ generated .add_answer_at_time (entry , 0 )
406+ zc .send (generated , "2001:db8::1" , const ._MDNS_PORT ) # https://www.iana.org/go/rfc3849
407+ time .sleep (0.2 )
408+ assert zc .cache .get (entry ) is None
409+
410+ zc .send (generated , "198.51.100.0" , const ._MDNS_PORT ) # Documentation (TEST-NET-2)
411+ time .sleep (0.2 )
412+ assert zc .cache .get (entry ) is None
413+
414+ zc .send (generated )
415+ time .sleep (0.2 )
416+ assert zc .cache .get (entry ) is not None
417+
418+ zc .close ()
You can’t perform that action at this time.
0 commit comments