⚲
Proyecto
General
Perfil
Iniciar sesión
Inicio
Proyectos
Ayuda
Búsqueda
:
Servidores centros secundaria
Todos los proyectos
Servidores centros secundaria
Vistazo
Actividad
Planificación
Peticiones
Gantt
Calendario
Noticias
Documentos
Wiki
Archivos
Repositorio
Descargar (873 Bytes)
Estadísticas
| Revisión:
root
/
autoclone
/
trunk
/
Server
/
ZeroconfService.py
@ 75
Ver
Histórico
Anotar
import
avahi
import
dbus
__all__
=
[
"ZeroconfService"
]
class
ZeroconfService
:
def
__init__
(
self
,
name
,
port
,
stype
=
"_http._tcp"
,
domain
=
""
,
host
=
""
,
text
=
""
):
self
.
name
=
name
self
.
stype
=
stype
self
.
domain
=
domain
self
.
host
=
host
self
.
port
=
port
self
.
text
=
text
def
publish
(
self
):
bus
=
dbus
.
SystemBus
()
server
=
dbus
.
Interface
(
bus
.
get_object
(
avahi
.
DBUS_NAME
,
avahi
.
DBUS_PATH_SERVER
),
avahi
.
DBUS_INTERFACE_SERVER
)
g
=
dbus
.
Interface
(
bus
.
get_object
(
avahi
.
DBUS_NAME
,
server
.
EntryGroupNew
()),
avahi
.
DBUS_INTERFACE_ENTRY_GROUP
)
g
.
AddService
(
avahi
.
IF_UNSPEC
,
avahi
.
PROTO_UNSPEC
,
dbus
.
UInt32
(
0
),
self
.
name
,
self
.
stype
,
self
.
domain
,
self
.
host
,
dbus
.
UInt16
(
self
.
port
),
self
.
text
)
g
.
Commit
()
self
.
group
=
g
def
unpublish
(
self
):
self
.
group
.
Reset
()
« Anterior
1
2
3
4
Siguiente »
(3-3/4)
Cargando...