Why many ports are opend?

in Help Center
Good Day!
ICE1.5.1 Windows XP VC++7.0
In ICE server I define the port is 10007,so i think port 10007 will be open .But in face i found many ports in ICE server PC were opend besides 10007. How can i close these ports?
Thanks!
my server code:
[HTML]string strSvcName = pcData->IPAddress + "PCManager";//ICE
//Ice::CommunicatorPtr icIP;
try
{
Ice::PropertiesPtr properties = Ice::createProperties();
properties->setProperty(strSvcName + ".Endpoints", "tcp -p 10007");
properties->setProperty("Ice.Trace.Network", "1");
properties->setProperty("Ice.Trace.Retry", "2");
properties->setProperty("Ice.GC.Interval", "180");
properties->setProperty("Ice.Warn.Leaks", "0");//
icIP = Ice::initializeWithProperties(argc, argv, properties);
Ice::ObjectAdapterPtr adapter = icIP->createObjectAdapter(strSvcName);
Ice::ObjectPtr object = (Ice::ObjectPtr)(new PCManagerI(IsGet, pcData));
adapter->add(object,Ice::stringToIdentity(strSvcName));
adapter->activate();
if (icIP)
{
icIP->waitForShutdown();
}
}
catch (const Ice::Exception & e)
{
cerr << e << endl;
status = 1;
}
catch (const char * msg)
{
cerr << msg << endl;
status = 1;
}
if (icIP)
{
icIP->destroy();
nDestroy = 1;
}[/HTML]
ICE1.5.1 Windows XP VC++7.0
In ICE server I define the port is 10007,so i think port 10007 will be open .But in face i found many ports in ICE server PC were opend besides 10007. How can i close these ports?
Thanks!
my server code:
[HTML]string strSvcName = pcData->IPAddress + "PCManager";//ICE
//Ice::CommunicatorPtr icIP;
try
{
Ice::PropertiesPtr properties = Ice::createProperties();
properties->setProperty(strSvcName + ".Endpoints", "tcp -p 10007");
properties->setProperty("Ice.Trace.Network", "1");
properties->setProperty("Ice.Trace.Retry", "2");
properties->setProperty("Ice.GC.Interval", "180");
properties->setProperty("Ice.Warn.Leaks", "0");//
icIP = Ice::initializeWithProperties(argc, argv, properties);
Ice::ObjectAdapterPtr adapter = icIP->createObjectAdapter(strSvcName);
Ice::ObjectPtr object = (Ice::ObjectPtr)(new PCManagerI(IsGet, pcData));
adapter->add(object,Ice::stringToIdentity(strSvcName));
adapter->activate();
if (icIP)
{
icIP->waitForShutdown();
}
}
catch (const Ice::Exception & e)
{
cerr << e << endl;
status = 1;
}
catch (const char * msg)
{
cerr << msg << endl;
status = 1;
}
if (icIP)
{
icIP->destroy();
nDestroy = 1;
}[/HTML]
0
Comments
If you have only one endpoint defined for your adapter, the server will listen only on that endpoint, so no other ports will be open.
The only other reason the server would be opening connections is if it makes invocations on other servers (or calls back into clients) via callback objects. In that case, you will find one open connection for each process your server makes an invocation on. However, these connections will be closed automatically once they are no longer needed.
How are you verifying that these connections in fact belong to your server?
When you run the server with Ice.Trace.Network=3, you will see all connection activity. (You may be seeing connections that are opened by other processes on the same machine, not by your server.)
Cheers,
Michi.
Also, there is of course a port for each outgoing connection, which is chosen by the operating system.
Oops, yes, I forgot about the loopback ports, thanks!
Michi.
oh!,yes ,my server has a callback object.so at all time ice server close some ports and open some others ports. I found less than ten ports were opend at a time. The case is right? what i said is right? Give me more! Thanks!
Can you give me more? Thanks!
First:
Proto LocalAddress ForeignAddress State PID
TCP Yjy:3772 LocalHost:3773 ESTABLISHED 7492
TCP Yjy:3773 LocalHost:3772 ESTABLISHED 7492
TCP Yjy:3775 LocalHost:3776 ESTABLISHED 7492
TCP Yjy:3776 LocalHost:3775 ESTABLISHED 7492
TCP Yjy:3783 172.16.6.6:1250 TIME_WAIT 0
TCP Yjy:3784 172.16.6.6:1257 TIME_WAIT 0
…… …… (7) …… …… ……
TCP Yjy:3792 172.16.6.6:1316 TIME_WAIT 0
TCP Yjy:3793 172.16.6.6:1323 TIME_WAIT 0
TCP Yjy:3794 172.16.6.6:1330 ESTABLISHED 7492
TCP Yjy:3795 172.16.6.6:1337 ESTABLISHED 7492
TCP Yjy:3796 172.16.6.6:1344 ESTABLISHED 7492
TCP Yjy:10007 172.16.6.6:1247 TIME_WAIT 0
TCP Yjy:10007 172.16.6.6:1254 TIME_WAIT 0
…… …… (5) …… ……
TCP Yjy:10007 172.16.6.6:1313 TIME_WAIT 0
TCP Yjy:10007 172.16.6.6:1320 TIME_WAIT 0
TCP Yjy:10007 172.16.6.6:1327 ESTABLISHED 7492
TCP Yjy:10007 172.16.6.6:1334 ESTABLISHED 7492
TCP Yjy:10007 172.16.6.6:1341 ESTABLISHED 7492
Second:
Proto LocalAddress ForeignAddress State PID
TCP Yjy:3772 LocalHost:3773 ESTABLISHED 7492
TCP Yjy:3773 LocalHost:3772 ESTABLISHED 7492
TCP Yjy:3775 LocalHost:3776 ESTABLISHED 7492
TCP Yjy:3776 LocalHost:3775 ESTABLISHED 7492
TCP Yjy:3786 172.16.6.6:1271 TIME_WAIT 0
TCP Yjy:3787 172.16.6.6:1280 TIME_WAIT 0
…… …… (7) …… ……
TCP Yjy:3795 172.16.6.6:1337 TIME_WAIT 0
TCP Yjy:3796 172.16.6.6:1344 TIME_WAIT 0
TCP Yjy:3797 172.16.6.6:1351 ESTABLISHED 7492
TCP Yjy:3798 172.16.6.6:1359 ESTABLISHED 7492
TCP Yjy:3799 172.16.6.6:1366 ESTABLISHED 7492
TCP Yjy:3800 172.16.6.6:1373 ESTABLISHED 7492
TCP Yjy:10007 172.16.6.6:1268 TIME_WAIT 0
TCP Yjy:10007 172.16.6.6:1277 TIME_WAIT 0
…… …… (5) …… ……
TCP Yjy:10007 172.16.6.6:1334 TIME_WAIT 0
TCP Yjy:10007 172.16.6.6:1341 TIME_WAIT 0
TCP Yjy:10007 172.16.6.6:1348 ESTABLISHED 7492
TCP Yjy:10007 172.16.6.6:1356 ESTABLISHED 7492
TCP Yjy:10007 172.16.6.6:1363 ESTABLISHED 7492
TCP Yjy:10007 172.16.6.6:1370 ESTABLISHED 7492
Thanks a lot!
I use netstat -o to get the two lists.I get the second list after half minute that I get the first list.