Comments (7)
Hi,
I created pull request.
#47
Best Regards,
from amsmb2.
Hi,
Thank you for your reply about pull request.
#47 (comment)
I checked packet.
I confirmed that smb2_write_async in libsmb2 is requesting with 61440 size.
I guess that the size has been changed to 61440 by the following function in libsmb2, but it is difficult to understand for me.
Please let me know if you notice any cause.
int
smb2_pwrite_async(struct smb2_context *smb2, struct smb2fh *fh,
uint8_t *buf, uint32_t count, uint64_t offset,
smb2_command_cb cb, void *cb_data)
{
struct smb2_write_request req;
struct rw_data *rd;
struct smb2_pdu *pdu;
int needed_credits = (count - 1) / 65536 + 1;
if (count > smb2->max_write_size) {
count = smb2->max_write_size;
}
if (smb2->dialect > SMB2_VERSION_0202) {
if (needed_credits > MAX_CREDITS - 16) {
count = (MAX_CREDITS - 16) * 65536;
}
needed_credits = (count - 1) / 65536 + 1;
if (needed_credits > smb2->credits) {
count = smb2->credits * 65536;
}
} else {
if (count > 65536) {
count = 65536;
}
}
rd = calloc(1, sizeof(struct rw_data));
if (rd == NULL) {
smb2_set_error(smb2, "Failed to allocate rw_data");
return -ENOMEM;
}
rd->cb = cb;
rd->cb_data = cb_data;
rd->fh = fh;
rd->offset = offset;
memset(&req, 0, sizeof(struct smb2_write_request));
req.length = count;
req.offset = offset;
req.buf = buf;
memcpy(req.file_id, fh->file_id, SMB2_FD_SIZE);
req.channel = SMB2_CHANNEL_NONE;
req.remaining_bytes = 0;
req.flags = 0;
pdu = smb2_cmd_write_async(smb2, &req, write_cb, rd);
if (pdu == NULL) {
smb2_set_error(smb2, "Failed to create write command");
return -ENOMEM;
}
smb2_queue_pdu(smb2, pdu);
return 0;
}
Best Regards,
from amsmb2.
Please check this issue #17
from amsmb2.
Hi,
Thank you for your reply.
I confirmed libsmb2 code, but I do not still understand why libsmb2 request to SMB server with 61440 byte.
However, as you advised, by setting a chunk size to 61440, my app was able to write files to the SMB server correctly.
Thank you very much.
By the way, the SMB protocol version of this server is 2.2
https://github.com/sahlberg/libsmb2/issues/43#issuecomment-392449832
I captured packet of iPad with Mac PC and following command, without jailbreak.
I'm sorry if you already know.
- Before capture packet :
rvictl -s [UUID of iOS Device]
- After capture packet :
rvictl -x [UUID of iOS Device]
https://developer.apple.com/documentation/network/recording_a_packet_trace
from amsmb2.
I confirmed libsmb2 code, but I do not still understand why libsmb2 request to SMB server with 61440 byte.
This value is changed to 65535 bytes in latest release. But I checked and the issue is still happening.
from amsmb2.
Hi,
It may be fixed in following commit of libsmb2.
sahlberg/libsmb2@aaad1ba
This was committed 22 days ago.
Does the following "libsmb2.a" in AMSMB2 contain this commit?
https://github.com/amosavian/AMSMB2/tree/master/libsmb2/lib
On the other hand, this commit is after v3.0.0 tag.
I am worried that this commit may not be stable.
from amsmb2.
Hi,
I tried chunk size to less than 61440.
But, error message "Inconsitency in writing to SMB file handle" was thrown as same.
So that, It seems that this issue has not resolved by this commit .
sahlberg/libsmb2@aaad1ba
As you advised, by setting a chunk size to 61440, my app was able to write files to the SMB server correctly.
#46 (comment)
I will close the issue.
Thank you very much for your advice.
from amsmb2.
Related Issues (20)
- SPM and xcframework HOT 1
- Unable to connect to windows 10 machine
- listShares error HOT 1
- Xcode compile for iOS target with swift package HOT 9
- iOS 15 fails with STATUS_LOGON_FAILURE HOT 4
- Multiple file upload HOT 3
- SPM Support HOT 5
- can someone know how to fix this HOT 1
- Upload the file keeping the original creation date HOT 1
- Cannot obtain data from Windows shares HOT 1
- Cannot extract data, move, download, copy; etc. from Linux or Windows shares with latin characters in file name HOT 8
- Which thread does amsmb2 run on HOT 1
- Connect to a Distributed File System-Namespaces HOT 1
- Uploading a folder HOT 1
- import AMSMB2 to xCode HOT 1
- macOS arm64 architecture missing HOT 2
- No such module 'SMB2' HOT 1
- Long delay when processing delete requests of recently uploaded items. HOT 1
- Struct smb2_context has removed member is_connected for the latest libsmb2? HOT 1
- Need support for M1 iphone simulator "arm64-apple-ios-simulator" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amsmb2.