-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.Net Core Support #35
base: master
Are you sure you want to change the base?
Conversation
This reverts commit 1ac69d9.
Signed-off-by: Hamidreza Mohaqeq <[email protected]>
Signed-off-by: Hamidreza Mohaqeq <[email protected]>
M2Mqtt/Net/MqttNetworkChannel.cs
Outdated
@@ -193,7 +197,11 @@ public MqttNetworkChannel(string remoteHostName, int remotePort, bool secure, X5 | |||
// in this case the parameter remoteHostName isn't a valid IP address | |||
if (remoteIpAddress == null) | |||
{ | |||
#if NETSTANDARD1_6 | |||
IPHostEntry hostEntry = Dns.GetHostEntryAsync(remoteHostName).Result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I understand it, it should look like this:
var getHostEntryTask = Dns.GetHostEntryAsync(remoteHostName);
getHostEntryTask.Wait();
IPHostEntry hostEntry = getHostEntryTask.Result;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference?
I think this is the longest one. Because "Result" blocks the call to get the value of task and "Wait" do the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right and I was wrong. Excuse me.
M2Mqtt/project.lock.json
Outdated
@@ -0,0 +1,4552 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should be added into the .gitignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
M2Mqtt/project.json
Outdated
@@ -0,0 +1,18 @@ | |||
{ | |||
"version": "1.0.0-*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean it must be "4.3.0.0"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it must be the same.
M2Mqtt/project.json
Outdated
}, | ||
|
||
"frameworks": { | ||
"netstandard1.6": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why your code depends on netstandard1.6 instead of its previous versions? Now the code is not compatible with previous versions of netstandard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because they removed the oldest one. I can just back to 1.5.0-rc2-24027. Is it OK?
@ppatierno Сould you tell about the state of the porting M2Mqtt project to the .NET Core? |
Fix Version Signed-off-by: Hamidreza Mohaqeq <[email protected]>
Signed-off-by: Hamidreza Mohaqeq <[email protected]>
Wrap this.socket.Shutdown in try and catch
Catch unhandled exception
Note, the M2Mqtt project runs fine on .NET Core 2.0, without any code changes, see my pull request #59 |
Ported to .NET Standard 2.0
Why the NETSTANDARD2_0 parts of the code? It works without those. Is it a better way to do it? Is the other way becoming deprecated? |
This was a port for .Net Standard 1.6. I just add the change to support .Net 2.0. |
@mohaqeq I wonder whether those changes were necessary at all. I tried porting to 1.6 too, which involved adding lots of However when I decided to support building on .NET Standard 2.0, I did NOT add Therefore I opted to forego .NET Standard 1.6 support, since 2.0 support did not require any code changes. So I think adding |
@Ghostbird I didn't try to build on .Net Standard 2.0 without these flags. I just checked that this solution works with .Net Standard 2.0. I will check if it is not necessary. |
@Ghostbird I've checked these flags and they are necessary. |
Without exception handling, the SendReceive call right after connect can lead the process to use 100% of CPU on the client machine.
Added try/catch to prevent unconstrained CPU usage
Fixing issue with long live connections & DNS updates
* Change for ALPN support. Add property of ALPN protocol names, and add constructor for use ALPN. * delete useless try-catch. * add comment about ALPN support * delete constructor, change alpnProtocols parameter as an optional param. * update comment about ALPN support.
A .Net Core project added to support .Net Core (.Net Standard 1.6) framework.