Comments (9)
Thank you for using this!
I do not know what kind of scene it will happen, so imagine and write.
If you use it occasionally, library can not detect changes in the IP address of the device, use old IP address.
Once connected, Sharpcifs keeps holding the value of the local IP address at the time of connection.
If the address changes, try the SmbFile.Initialize();
Execution order is:
SharpCifs.Config.SetProperty ("jcifs.smb.client.laddr", [ip address]);
SmbFile.Initialize();
var smbFile = new SmbFile ("connection uri string");
var list = smbFile.listFiles();
I hope that Google Translate will show you well!
from sharpcifs.std.
The problem is caused by the call to Socket.SendToAsync(args) in the Send method of SocketEx. The Completed event in SocketAsyncEventArgs never gets called, because (I am guessing) it is running synchronously as mentioned here ...
https://blogs.msdn.microsoft.com/dotnet/2017/06/07/performance-improvements-in-net-core/
I read the source of socket.cs and whilst I think the boolean that SendToAsync sets might mean it ran synchronously, I'm not sure. If it is, just doing this in SocketEx.Send will fix the issue ...
if (SendToAsync(args))
{
if (!evt.Wait(_soTimeOut))
{
throw new TimeoutException("No data sent.");
}
}
If not, replacing the whole method with this ...
public void Send(byte[] buffer, int offset, int length, EndPoint destination = null)
{
using (var evt = new ManualResetEventSlim(false))
{
base.BeginSendTo(buffer, offset, length, SocketFlags.None, destination ?? RemoteEndPoint, new AsyncCallback(delegate { evt.Set(); }), this);
if (!evt.Wait(_soTimeOut))
{
throw new TimeoutException("No data sent.");
}
}
}
definitely will.
from sharpcifs.std.
I am seeing the same behavior. You solution works perfectly. Thanks !
from sharpcifs.std.
Thanks for your feedbacks!
I could not reproduce in my own environment(Win10, .NetCore2.0 SDK),
"SocketAsyncEventArgs.Completed" event always raised on my code.
Please tell me about your environment.
and, fix SocketEx.cs on dev-branch:
https://github.com/ume05rw/SharpCifs.Std/blob/dev/SharpCifs.STD1.3/Util/Sharpen/SocketEx.cs
I am glad if you try this code to see if it works correctly.
from sharpcifs.std.
Your environment is the same as mine. I am seeing the behaviour via a Windows .Net Core 2.0 Test Project. Interestingly, the problem does not happen in an Android deployment of the code.
Your dev-branch SocketEx fixes the problem.
I'm looking forward to you updating your nuget package so I can dispense with the local copy of the code.
By the way - thanks for this project!
from sharpcifs.std.
I published now, new ver 0.2.10.
https://www.nuget.org/packages/SharpCifs.Std/0.2.10
thank you everyone!
from sharpcifs.std.
Does anyone still have a look at this issue?
I could not reproduce this problem, so it's a bit indigestion...
If problems also occur, I will resume this issue!
from sharpcifs.std.
from sharpcifs.std.
from sharpcifs.std.
Related Issues (20)
- 0.2.12 nuget-package not installable
- Kerberos Authentication
- File author
- How can load image HOT 2
- Smb Connection fail HOT 1
- GetShareSecurity() returns null GetSecurity() catches timeout
- SMB-File does not take data
- ListFiles does not return control
- mbFile.Initialize() Error
- ((Stream)OutputStream).CanSeek is true, but Seek() throws an exception
- "Connect & Auth:" examples return true for the base domain of any local IP
- How to check file is written
- char # in uri will cause error HOT 1
- IO Exception: transport closed in negotiate HOT 2
- 异常未捕捉到导致死循环
- CancellationToken overload for GetOutputStreamAsync
- SharpCifs.Smb.SmbException: Failed to connect, 0.0.0.0<00>/192.168.0.26 [ 192.168.0.26:1733 --> 192.168.0.26:445 ] HOT 2
- SmbTransport.ClearCachedConnections with force=true leads to InvalidOperationException HOT 4
- SharpCifs.Smb.SmbException : This client does not support the negotiated dialect.
- Dual License
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 sharpcifs.std.