After I looked into the source code deeply, I thought
there is a bug in the advertisement time setting.
When you call UpnpSendAdvertisement(handle, exp),
the implementation of UpnpSendAdvertisement() will call
ScheduleTimerEvent(exp -
AUTO_ADVERTISEMENT_TIME, ... ), where
AUTO_ADVERTISEMENT_TIME = 30. So as long as
you set exp to be less than 30 seconds, actually it will
advertise immediately. While inside the SSDP packet,
its maximum age is the "exp", which doesn't match the
real case.
-Xiao