Archived

This forum has been archived. Please start a new discussion on GitHub.

Why many ports are opend?

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]

Comments

  • skyriver wrote:
    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?

    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.
  • marc
    marc Florida
    Actually, on Windows, there is one additional pair of ports per thread pool, which is used to interrupt select(). These are ports on the loopback network. For Unix, a pipe is used instead.

    Also, there is of course a port for each outgoing connection, which is chosen by the operating system.
  • marc wrote:
    Actually, on Windows, there is one additional pair of ports per thread pool, which is used to interrupt select(). These are ports on the loopback network. For Unix, a pipe is used instead.

    Oops, yes, I forgot about the loopback ports, thanks!

    Michi.
  • Thanks you two!

    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!
    Actually, on Windows, there is one additional pair of ports per thread pool, which is used to interrupt select(). These are ports on the loopback network. For Unix, a pipe is used instead.

    Also, there is of course a port for each outgoing connection, which is chosen by the operating system.
    Can you give me more? Thanks!
  • marc
    marc Florida
    Show me the listing of all ports, and I tell you which one is for what.
  • Thanks to marc!

    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!
  • marc
    marc Florida
    What is "first" and "second" in your listing? Can you use netstat -p tcp -ab so that we know which ports belong to which processes, and also see the listening ports? Also, please enable network tracing for both the client and the server, and post the results here, so that you can see what connections are established. Use Ice.Trace.Network=1.
  • Thanks!

    I use netstat -o to get the two lists.I get the second list after half minute that I get the first list.