|
楼主 |
发表于 2008-5-26 11:10:25
|
显示全部楼层
可以看到ACE_INET_Addr那个类里面,
inet_addr.sin_addr.S_un.S_un_b两次分别是10.80.1.104和10.80.1.115
inet_addr.sin_addr.S_un.S_un_w两次分别是{s_w1=20490 s_w2=26625}和{s_w1=20490 s_w2=29441}
inet_addr.sin_addr.S_un.S_addr两次分别是1744916490和1929465866
测试程序大致是这样:
int ACE_TMAIN(int argc, ACE_TCHAR* argv[])
{
ACE_Thread::spawn((ACE_THR_FUNC)worker1);
ACE_Thread::spawn((ACE_THR_FUNC)worker2);
//......and so on
}
ACE_THR_FUNC_RETURN worker1(void*)
{
ACE_INET_Addr remote_addr(5050, "10.80.1.115");
ACE_INET_Addr local_addr(8067);
ACE_SOCK_Connector connector;
ACE_SOCK_Stream stream;
if (connector.connect(stream, remote_addr, 0, local_addr, 1) == -1)
{
ACE_OS::sleep(3);
ACE_ERROR_RETURN((LM_ERROR, "(%P|%t) %p\n", "connection fail"), -1);
}
//.....and so on
}
ACE_THR_FUNC_RETURN worker2(void*)
{
ACE_INET_Addr remote_addr(5050, "10.80.1.104");
ACE_INET_Addr local_addr(8067);
ACE_SOCK_Connector connector;
ACE_SOCK_Stream stream;
if (connector.connect(stream, remote_addr, 0, local_addr, 1) == -1)
{
ACE_OS::sleep(3);
ACE_ERROR_RETURN((LM_ERROR, "(%P|%t) %p\n", "connection fail"), -1);
}
//.....and so on
}
[ 本帖最后由 sokiiya 于 2008-5-26 11:26 编辑 ] |
|