.\" 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 .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Net::VNC 3pm" .TH Net::VNC 3pm "2021-01-06" "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::VNC \- A simple VNC client .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Net::VNC; \& \& my $vnc = Net::VNC\->new({hostname => $hostname, password => $password}); \& $vnc\->depth(24); \& $vnc\->login; \& \& print $vnc\->name . ": " . $vnc\->width . \*(Aq x \*(Aq . $vnc\->height . "\en"; \& \& my $image = $vnc\->capture; \& $image\->save("out.png"); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Virtual Network Computing (\s-1VNC\s0) is a desktop sharing system which uses the \s-1RFB\s0 (Remote FrameBuffer) protocol to remotely control another computer. This module acts as a \s-1VNC\s0 client and communicates to a \s-1VNC\s0 server using the \s-1RFB\s0 protocol, allowing you to capture the screen of the remote computer. .PP This module dies upon connection errors (with a timeout of 15 seconds) and protocol errors. .PP This implementation is based largely on the \s-1RFB\s0 Protocol Specification, . That document has an error in the \s-1DES\s0 encryption description, which is clarified via . .SH "METHODS" .IX Header "METHODS" .SS "new" .IX Subsection "new" The constructor. Given a hostname and a password returns a Net::VNC object: .PP .Vb 1 \& my $vnc = Net::VNC\->new({hostname => $hostname, password => $password}); .Ve .PP Optionally, you can also specify a port, which defaults to 5900. For \s-1ARD\s0 (Apple Remote Desktop) authentication you must also specify a username. You must also install Crypt::GCrypt::MPI and Crypt::Random. .SS "login" .IX Subsection "login" Logs into the remote computer: .PP .Vb 1 \& $vnc\->login; .Ve .SS "name" .IX Subsection "name" Returns the name of the remote computer: .PP .Vb 1 \& print $vnc\->name . ": " . $vnc\->width . \*(Aq x \*(Aq . $vnc\->height . "\en"; .Ve .SS "width" .IX Subsection "width" Returns the width of the remote screen: .PP .Vb 1 \& print $vnc\->name . ": " . $vnc\->width . \*(Aq x \*(Aq . $vnc\->height . "\en"; .Ve .SS "height" .IX Subsection "height" Returns the height of the remote screen: .PP .Vb 1 \& print $vnc\->name . ": " . $vnc\->width . \*(Aq x \*(Aq . $vnc\->height . "\en"; .Ve .SS "capture" .IX Subsection "capture" Captures the screen of the remote computer, returning an Image::Imlib2 object: .PP .Vb 2 \& my $image = $vnc\->capture; \& $image\->save("out.png"); .Ve .PP You may call \fBcapture()\fR multiple times. Each time, the \f(CW$image\fR buffer is overwritten with the updated screen. So, to create a series of ten screen shots: .PP .Vb 5 \& for my $n (1..10) { \& my $filename = sprintf \*(Aqsnapshot%02d.png\*(Aq, $n++; \& $vnc\->capture()\->save($filename); \& print "Wrote $filename\en"; \& } .Ve .SS "depth" .IX Subsection "depth" Specify the bit depth for the screen. The supported choices are 24, 16 or 8. If unspecified, the server's default value is used. This property should be set before the call to \fBlogin()\fR. .SS "save_bandwidth" .IX Subsection "save_bandwidth" Accepts a boolean, defaults to false. Specifies whether to use more CPU-intensive algorithms to compress the \s-1VNC\s0 datastream. \s-1LAN\s0 or localhost connections may prefer to leave this false. This property should be set before the call to \fBlogin()\fR. .SS "list_encodings" .IX Subsection "list_encodings" Returns a list of encoding number/encoding name pairs. This can be used as a class method like so: .PP .Vb 1 \& my %encodings = Net::VNC\->list_encodings(); .Ve .SS "send_key_event_down" .IX Subsection "send_key_event_down" Send a key down event. The keys are the same as the corresponding \s-1ASCII\s0 value. Other common keys: .PP .Vb 10 \& BackSpace 0xff08 \& Tab 0xff09 \& Return or Enter 0xff0d \& Escape 0xff1b \& Insert 0xff63 \& Delete 0xffff \& Home 0xff50 \& End 0xff57 \& Page Up 0xff55 \& Page Down 0xff56 \& Left 0xff51 \& Up 0xff52 \& Right 0xff53 \& Down 0xff54 \& F1 0xffbe \& F2 0xffbf \& F3 0xffc0 \& F4 0xffc1 \& ... ... \& F12 0xffc9 \& Shift (left) 0xffe1 \& Shift (right) 0xffe2 \& Control (left) 0xffe3 \& Control (right) 0xffe4 \& Meta (left) 0xffe7 \& Meta (right) 0xffe8 \& Alt (left) 0xffe9 \& Alt (right) 0xffea \& \& $vnc\->send_key_event_down(\*(AqA\*(Aq); .Ve .SS "send_key_event_up" .IX Subsection "send_key_event_up" Send a key up event: .PP .Vb 1 \& $vnc\->send_key_event_up(\*(AqA\*(Aq); .Ve .SS "send_key_event" .IX Subsection "send_key_event" Send a key down event followed by a key up event: .PP .Vb 1 \& $vnc\->send_key_event(\*(AqA\*(Aq); .Ve .SS "send_key_event_string" .IX Subsection "send_key_event_string" Send key events for every character in a string: .PP .Vb 1 \& $vnc\->send_key_event_string(\*(AqHello\*(Aq); .Ve .ie n .SS "send_pointer_event( $button_mask, $x, $y )" .el .SS "send_pointer_event( \f(CW$button_mask\fP, \f(CW$x\fP, \f(CW$y\fP )" .IX Subsection "send_pointer_event( $button_mask, $x, $y )" Send pointer event (usually a mouse). This is used to move the pointer or make clicks or drags. .PP It is easier to call the \f(CW\*(C`mouse_move\*(C'\fR or methods instead. .ie n .SS "mouse_move_to($x, $y)" .el .SS "mouse_move_to($x, \f(CW$y\fP)" .IX Subsection "mouse_move_to($x, $y)" Send the pointer to the given position. The cursor instantly jumps there instead of smoothly moving to there. .SS "mouse_click" .IX Subsection "mouse_click" Click on current pointer position. .SS "mouse_right_click" .IX Subsection "mouse_right_click" Right-click on current pointer position. .SH "BUGS AND LIMITATIONS" .IX Header "BUGS AND LIMITATIONS" .SS "Bit depth" .IX Subsection "Bit depth" We do not yet support 8\-bit true-colour mode, which is commonly supported by servers but is rarely employed by clients. .SS "Byte order" .IX Subsection "Byte order" We have currently tested this package against servers with the same byte order as the client. This might break with a little-endian server/big\-endian client or vice versa. We're working on tests for those latter cases. Testing and patching help would be appreciated. .SS "Efficiency" .IX Subsection "Efficiency" We've implemented a subset of the data compression algorithms supported by most \s-1VNC\s0 servers. We hope to add more of the high-compression transfer encodings in the future. .SH "AUTHORS" .IX Header "AUTHORS" Leon Brocard acme@astray.com .PP Chris Dolan clotho@cpan.org .PP Apple Remote Desktop authentication based on LibVNCServer .PP Maurice Castro maurice@ipexchange.com.au .PP Many thanks for Foxtons Ltd for giving Leon the opportunity to write the original version of this module. .PP Copyright (C) 2006, Leon Brocard .PP This module is free software; you can redistribute it or modify it under the same terms as Perl itself.