2
我試圖寫一個Silverlight應用程序,插座可以連接到127.0.0.1:4505但arg.completed事件不起作用SilverLight的插座問題
arg.RemoteEndPoint = new IPEndPoint(IPAddress.Loopback, 4505);
arg.UserToken = sck;
arg.Completed += new EventHandler<SocketAsyncEventArgs>(arg_Completed);
sck.ConnectAsync(arg);
void arg_Completed(object sender, SocketAsyncEventArgs e)
{
label1.Content = "Durum!";
if (e.LastOperation == SocketAsyncOperation.Connect)
{
label1.Content = "Bağlandı!";
}
}