'pysmb storefile fails for file over 100K
I am trying to save files from Win11 to my Android phone, using "Lan drive" app to start the samba service on the Android phone. The following codes work only for "small" files. It will always fail if the file size is "large" - seems anything over 100K will guarantee a failure.
from smb.SMBConnection import SMBConnection
def writetosmB(filename, ip='', myport=1445, user='x', pw='x', sharefolder='Smb'):
smb_conn = SMBConnection(username=user, password=pw, my_name='name', remote_name=sharefolder)
try:
is_connected = smb_conn.connect(ip, myport, timeout=60)
except :
print("[!] %s is up but refuses smb connection:(( "%ip)
if is_connected:
with open(filename, 'rb') as in_file:
smb_conn.storeFile('Smb', "testfile.pdf", in_file)
When saving "larger" files, the following error will occur: File "D:\Anaconda\lib\site-packages\nmb\base.py", line 89, in _sendNMBPacket_NetBIOS assert length <= 0x01FFFF AssertionError
Does that mean pysmb can only save "small" files? Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
