我有两台电脑正在运行代理.它们通过LAN(或wifi)连接.我希望这些代理商进行沟通.我找到的方法之一是给代理商的完整地址.下面是代码片段.
AID a = new AID("A@192.168.14.51:1099/JADE",AID.ISGUID);
a.addAddresses("http://192.168.14.51:7778/acc");
msg.addReceiver(a);
send(msg);
Run Code Online (Sandbox Code Playgroud)
然而,一旦我在一个平台上启动代理,我希望其他平台上的代理能够在其黄页上注册服务,以便我可以从同一列表中搜索适当的代理.我看了但却找不到任何关于它的信息.请给我一些关于如何实现这一目标的建议.
我试图产生一定数量的线程.但是当我向函数传递参数时,输出是随机的.它多次选择变量'i'的某些值并忽略一些.我是C#的新手.请解释我做错了什么.
using System;
using System.Threading;
public class first
{
public static void tone(int i)
{
Console.WriteLine("Hi ! this is thread : {0} ",i);
Thread.Sleep(10);
}
public static void Main(String[] args)
{
int i;
for (i = 0; i < 10; i++)
{
Thread th1 = new Thread(()=>tone(i) );
th1.Start();
// Console.WriteLine(i);
}
Console.WriteLine("hey there!");
Console.ReadLine();
}
Run Code Online (Sandbox Code Playgroud)
}