我想使用nuGet库中的Socketex.tcpclient
。
我这样添加:
当我想在应用程序中使用它时
using Microsoft.Phone.Controls;
using System;
using System.Windows;
using System.Windows.Navigation;
using SocketEx;
using System.Threading;
namespace HomeSecurityClient {
public partial class MainPage : PhoneApplicationPage {
private string localIP, globalIP, port;
private Thread sendThread;
public MainPage() {
InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e) {
base.OnNavigatedTo(e);
String args = null;
NavigationContext.QueryString.TryGetValue("ms_nfp_launchargs", out args);
if (args != null) {
MessageBox.Show(args);
string[] splittedArgs = args.Split(' ');
globalIP = splittedArgs[0];
port = splittedArgs[1];
localIP = splittedArgs[2];
makeSwitch();
sendThread = new Thread(new ThreadStart(makeSwitch));
sendThread.Start();
}
}
private void makeSwitch() {
TcpClient client = new TcpClient(localIP, Int32.Parse(port));//THIS CAUSES THIS MESSAGE
// client.Connect(localIP, Int32.Parse(port));
}
}
}
在我接受消息框并调用方法makeSwitch
后,我得到:
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\Data\Programs\{39989B95-A54A-4810-B4EE-35B33265A680}\Install\socketex.tcpclient.DLL'. Cannot find or open the PDB file.
param=89.77.153.205
13000
192.168.0.13
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.ni.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.Net.ni.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.Net.ni.dll
param=89.77.153.205
13000
192.168.0.13
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.Net.ni.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.Net.ni.dll
The thread 0x38 has exited with code 259 (0x103).
如何解决?