1Net::SSH2::File(3) User Contributed Perl Documentation Net::SSH2::File(3)
2
3
4
6 Net::SSH2::File - SSH2 SFTP file object
7
9 An SFTP file object is created by the Net::SSH2::SFTP "open" method.
10
11 read ( buffer, size )
12 Read size bytes from the file into a given buffer. Returns number of
13 bytes read, or undef on failure.
14
15 write ( buffer )
16 Write buffer to the remote file.
17
18 The "libssh2_sftp_write" function wrapped by this method has a complex
19 and quite difficult (if not impossible at all) to use API. It tries to
20 hide the packet pipelining being done under the hood in order to attain
21 decent throughput.
22
23 Net::SSH2 can not hide that complexity without negatively affecting the
24 transmission speed so it provides just a thin wrapper for that library
25 function.
26
27 An excerpt from "libssh2_sftp_write" manual page follows:
28
29 WRITE AHEAD
30
31 Starting in libssh2 version 1.2.8, the default behavior of libssh2
32 is to create several smaller outgoing packets for all data you pass
33 to this function and it will return a positive number as soon as the
34 first packet is acknowledged from the server.
35
36 This has the effect that sometimes more data has been sent off but
37 isn't acked yet when this function returns, and when this function
38 is subsequently called again to write more data, libssh2 will
39 immediately figure out that the data is already received remotely.
40
41 In most normal situation this should not cause any problems, but it
42 should be noted that if you've once called libssh2_sftp_write() with
43 data and it returns short, you MUST still assume that the rest of
44 the data might've been cached so you need to make sure you don't
45 alter that data and think that the version you have in your next
46 function invoke will be detected or used.
47
48 The reason for this funny behavior is that SFTP can only send 32K
49 data in each packet and it gets all packets acked individually. This
50 means we cannot use a simple serial approach if we want to reach
51 high performance even on high latency connections. And we want that.
52
53 stat
54 Returns file attributes; see Net::SSH2::SFTP::stat.
55
56 setstat ( key, value... )
57 Sets file attributes; see Net::SSH2::SFTP::setstat.
58
59 seek ( offset )
60 Set the file pointer offset.
61
62 tell
63 Returns the current file pointer offset.
64
66 Net::SSH2::SFTP.
67
68 Check Net::SFTP::Foreign for a high level, perlish and easy to use SFTP
69 client module. It can work on top of Net::SSH2 via the
70 Net::SFTP::Foreign::Backend::Net_SSH2 backend module.
71
73 Copyright (C) 2005, 2006 by David B. Robins <dbrobins@cpan.org>;
74
75 Copyright (C) 2015 by Salvador FandiƱo <sfandino@yahoo.com>;
76
77 All rights reserved.
78
79 This library is free software; you can redistribute it and/or modify it
80 under the same terms as Perl itself, either Perl version 5.8.0 or, at
81 your option, any later version of Perl 5 you may have available.
82
83 The documentation for this package contains and excerpt from libssh2
84 manual pages. You can consult the license of the libssh2 project for
85 the conditions regulating the copyright of that part.
86
87
88
89perl v5.28.1 2017-01-06 Net::SSH2::File(3)