Reputation: 185
I think this may have something to do with the dependencies, but I'm not really sure.
So I'm trying to check to see if a TCP connection is still active using the extension method I found here, but I'm getting a missing method exception:
"Method not found: 'System.Net.IPEndPoint System.Net.NetworkInformation.TcpConnectionInformation.get_LocalEndPoint()'"
Which I'm a little confused on since the method seems to exist.
Here's the code:
public static TcpState GetState(this TcpClient tcpClient)
{
var status = IPGlobalProperties.GetIPGlobalProperties()
.GetActiveTcpConnections()
.SingleOrDefault(x => x.LocalEndPoint.Equals(tcpClient.Client.LocalEndPoint));
return status != null ? status.State : TcpState.Unknown;
}
and the JSON file where I think there might be a problem in how NetworkInformation is referenced:
{
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
},
"imports": "dnxcore50"
}
},
"dependencies": {
"system.net.networkinformation": "4.0.10-beta-23123"
},
"version": "1.0.0-*"
}
Am I on the right track? How would I fix it?
Upvotes: 0
Views: 864
Reputation: 5085
Try adding system.net.security
package also, as system.net.networkinformation
depends on security package. It might not have loaded dependencies automatically.
Upvotes: 1