.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Net::Bonjour::Entry 3pm" .TH Net::Bonjour::Entry 3pm "2021-01-05" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Net::Bonjour::Entry \- Support module for mDNS service discovery (Apple's Bonjour) .SH "SYNOPSIS" .IX Header "SYNOPSIS" use Net::Bonjour; .PP my \f(CW$res\fR = Net::Bonjour\->new([, ]); \&\f(CW$res\fR\->discover; .PP foreach my \f(CW$entry\fR ( \f(CW$res\fR\->entries ) { print \f(CW$entry\fR\->name, \*(L"\en\*(R"; } .SH "DESCRIPTION" .IX Header "DESCRIPTION" Net::Bonjour::Entry is a module used to manage entries returned by a mDNS service discovery (Apple's Bonjour). See Net::Bonjour for more information. .SH "METHODS" .IX Header "METHODS" .SS "new([])" .IX Subsection "new([])" Creates a new Net::Bonjour::Entry object. The optional argument defines the fully qualifed domain name (\s-1FQDN\s0) of the entry. Normal usage of the Net::Bonjour module will not require the construction of Net::Bonjour::Entry objects, as they are automatically created during the discovery process. .SS "address" .IX Subsection "address" Returns the \s-1IP\s0 address of the entry. .SS "all_attrs" .IX Subsection "all_attrs" Returns all the current attributes in the form of hashed array. .SS "attribute()" .IX Subsection "attribute()" Returns the specified attribute from the \s-1TXT\s0 record of the entry. \s-1TXT\s0 records are used to specify additional information, e.g. path for http. .SS "dnsrr([])" .IX Subsection "dnsrr([])" Returns an \s-1DNS\s0 answer packet of the entry. The output will be in the format of a Net::DNS::Packet object. The \fIrecord type\fR designates the resource record to answer with, i.e. \s-1PTR, SRV,\s0 or \s-1TXT.\s0 The default is \s-1PTR.\s0 .SS "fetch" .IX Subsection "fetch" Reloads the information for the entry via mDNS. .SS "fqdn" .IX Subsection "fqdn" Returns the fully qualifed domain name (\s-1FQDN\s0) of entry. An example \s-1FQDN\s0 is server._afpovertcp._tcp.local .SS "hostname" .IX Subsection "hostname" Returns the hostname of the server, e.g. 'server.local'. .SS "name" .IX Subsection "name" Returns the name of the entry. In the case of the fqdn example, the name would be 'server'. This name may not be the hostname of the server. For example, names for presence/tcp will be the name of the user and http/tcp will be title of the web resource. .SS "port" .IX Subsection "port" Returns the \s-1TCP\s0 or \s-1UDP\s0 port of the entry. .SS "sockaddr" .IX Subsection "sockaddr" Returns the binary socket address for the resource and can be used directly to \fBbind()\fR sockets. .SH "EXAMPLES" .IX Header "EXAMPLES" .SS "Print out a list of local websites" .IX Subsection "Print out a list of local websites" .Vb 1 \& print "Local Websites"; \& \& use Net::Bonjour; \& \& my $res = Net::Bonjour\->new(\*(Aqhttp\*(Aq); \& $res\->discover; \& \& foreach my $entry ( $res\->entries) { \& printf "%s
", \& $entry\->address, $entry\->attribute(\*(Aqpath\*(Aq), \& $entry\->name; \& } \& \& print ""; .Ve .SS "Find a service and connect to it" .IX Subsection "Find a service and connect to it" .Vb 1 \& use Net::Bonjour; \& \& my $res = Net::Bonjour\->new(\*(Aqcustom\*(Aq); \& $res\->discover; \& \& my $entry = $res\->shift_entry; \& \& socket SOCK, PF_INET, SOCK_STREAM, scalar(getprotobyname(\*(Aqtcp\*(Aq)); \& \& connect SOCK, $entry\->sockaddr; \& \& print SOCK "Send a message to the service"; \& \& while ($line = ) { print $line; } \& \& close SOCK; .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" Net::Bonjour .SH "COPYRIGHT" .IX Header "COPYRIGHT" This library is free software and can be distributed or modified under the same terms as Perl itself. .PP Bonjour (in this context) is a trademark of Apple Computer, Inc. .SH "AUTHORS" .IX Header "AUTHORS" The Net::Bonjour::Entry module was created by George Chlipala