Selector.open() uses two TCP ports on Windows

As part of a security review, we are monitoring the ports opened by our application (which uses NIO) using TCPView on Windows Vista Business with sp1.
I ran the NIO test below.
public class NioSelectorMain {
public static void main(String[] args) throws Exception {
Selector selector = Selector.open();
System.out.println(selector);
Thread.sleep(Integer.MAX_VALUE);
Example output is:
sun.nio.ch.WindowsSelectorImpl@b1c5fa
TCPView showed the following two ports opened - the numbers change each time obviously, but there are always two ports.
javaw.exe:8224     TCP     aled-PC:50741     localhost:50742     ESTABLISHED     
javaw.exe:8224     TCP     aled-PC:50742     localhost:50741     ESTABLISHED     
I've tried this with sun jdk1.6.0_05 and jdk1.5.0_14. When running the same test on Linux, no ports are opened.
Why are these ports used, and is there any way to either prevent them from being opened or to specify which ports should be used?
Thanks in advance, Aled

Thanks for the very prompt reply!
or to specify which ports should be used?Why would you want to do that?Our enterprise customers would like to know which ports will be used so that they can lock down the machine as much as possible, and can better detect malicious programs/usage.
I presume by "why would you want to do that" that it's not possible?

Similar Messages

  • PC Suite with Nokia 5700 uses two COM ports?

    I am using Nokia PC Suite 6.84 with a Nokia 5700. The phone is connected to the laptop via a USB cable. I have installed the software on two separate laptops, one running XP with Service Pack 2, another running Vista.
    Whenever I plug-in the phone, I see two COM ports associated with it. The first COM port shows up in Window’s device manager as COM port 6 (see attached JPG), however, this COM port seems invalid. When I use HyperTerminal, I see two COM ports displayed: COM port 6 and COM port 7. Using HyperTerminal, I can communicate with the Nokia 5700 on COM port 7 but COM port 6 is always unresponsive.
    Can anyone tell me:
    1. Why two COM ports are used with the Nokia 5700 and PC Suite?
    2. What is the purpose of these two COM ports?
    3. Are they always contiguous? On different computers, I have seen the Nokia phone bind to COM ports 6 and 7, 9 and 10, and 10 and 11.
    NOTE: I could not attach the file as a JPG, so I renamed it with a *.log extension. Just replace with .log with .jpg and view it in any browser.
    Attachments:
    NokiaComPortProblem.log ‏82 KB

    So, nobody knows for what it is?
    Symbian freeware http://symbiancorner.blogspot.com

  • DLSW use which tcp port to transmit and receive data.

    i wang to know at which tcp or udp port does DLSW OR dlsw+ use to transport data?
    thank you.

    It really depends on the vendor. RFC1795 defines TCP 2065 and 2067 for DLSw. However, Cisco routers only uses TCP 2065 in DLSw version 1 mode. Cisco routers support DLSw version 2 (RFC 2166) in 11.3T. If two Cisco routers with 12.0 software, Cisco routers use UDP 2067 on top of TCP port 2065.

  • Applet is opening too many TCP ports

    Hi,
    I have developed an aplication running as an applet, the
    applet is in a remote computer with apache
    when I start the applet from a client, sometimes appears
    pretty fast (30 or 40 seconds) and sometimes appears after
    10 minutes, or never !!
    If a make a netstat in the client computer, i can see more
    than 500 ports opened against the port 80 of the server
    (most of them in finished state)
    What is going on ? where is the problem ?
    Thankyou very much

    Hi,
    (a) Server Side only.
    (b) Yes. but only on the callback interface, which passes back recently created Player / Game remote objects.
    (c) No socket factory. I'm using whatever is default.
    (d). Yes:
    Server
    Registry = LocateRegistry.createRegistry(10000);
    // all remote objects are exported to the same port (however this value used to be 0)
    UnicastRemoteObject.exportObject(instance,10001);
    Client
    // callback interface
    UnicastRemoteObject.exportObject(callback,0);Regards,
    Rich

  • How to use two different port numbers for a single OC4J container

    Hi,
    I have a container OC4J_System running in 7998 port, now I want to add one more port for the same container.
    Is it feasible?
    Kindly help me out.
    Regards
    Vicky

    It's quite complicated, see
    Two Page Numbering Schemes in the Same Document.
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • Using two ipods on my windows computer

    i have been using itunes on my windows pc for my 30gb ipod, i want to add music to my friends ipod mini using the same itunes library, i have seperated the music that i want to add to the mini into a playlist but whenever i try to "sync music through selected playlists" it tells me all music currently on the ipod will be erased. i do not have my friends original music on my itunes library so i do not want to erase it as i cannot replace it. Itunes will not even let me burn the original music on the mini to disc so as to re-load it later. please can anyone let me know of an alternative?? i have tried to "transfer purchases from ipod" but this does not work either, even though i have authorised the computer. and have also tried to "manage music manually" but it gives the same erase original music threat.

    Apple intentionally made the iPod to work this way to help stem the illegal sharing of copyrighted material which is what you are trying to do.
    "i have tried to "transfer purchases from ipod" but this does not work either, even though i have authorised the computer."
    Doesn't work that way. It wasn't your iTunes account that purchased the music.

  • Can anyone tell me why RADIUS uses two UDP port while TACACS+ uses only one ?

    I dont know the answer. Someone asked me in an interview.

    You can enable separate servers for authentication/authorization, and use separate servers for accounting.
    However that is the way the protocol was designed there isn't a clear explanation what drove that decision.
    It would be a great question to ask in your thank you letter.
    Thanks

  • Random TCP connections created in Selector.open (in NIO)

    I'm currenlty running a production app which has several independently running application server classes going at any given time. Each of these uses one Selector to provide support for asynchronous I/O operations. Lately I noticed that when bouncing one of these servers I'd have problems bringing it back up because of sequential "ghost listeners" and "ghost connections" colliding with the ports I was interested in.
    So, I got out a local port-scanner and did some digging. To my chagrin I discovered that every time I made a call to Selector.open() a new TCP connection was made from my application to my application on an internal port. In Java 1.4.2_02 this occured on the "primary" network adapter. In Java 1.5 this occured on the loopback adapter. Unfortunately for me neither is acceptable because my app regularly binds and unbinds for listening on varying adapters including the wildcard adapter (0.0.0.0) and I can't have my own process colliding with itself trying to listen to ports.
    Okay, so then I did some forum searching with the help of a couple co-workers. It turns out these connections are "normal" and related to something called the "wakupPipe", or "wakup pipe". Also, this seems somewhat related to something we call the "runaway select event" in-house (where Selector.select(x) returns 0 before the timeout is up over and over again, which we've long since worked around to support Java 1.4.2_02).
    This problem occurs on windows 2000 and windows server 2003. I've attached a code-snippet below that will duplicate the problem (and flood a system with extraneous TCP connections if left running long enough).
    My questions are:
    1) Why in the world did this wakup pipe have to be implemented as a TCP connection (rather than in-memory)?
    2) Why is this not documented anywhere in the Java API's, or am I missing the documentation of it?
    3) Is there some way to control the behaviour of this "wakup pipe"? (ie: make it be in-memory only, a file, or specify port-range, IP etc...)
    4) Isn't it dangerous to create a library based on undocumented and randomly allocated TCP connections that can't be controlled via configuration?
    import java.nio.channels.Selector;
    import java.util.ArrayList;
    public class NIOSelectorOpenExample implements Runnable {
        protected boolean shouldRun = true;
        public void shutdown() { shouldRun = false; }
        public void run()
          try {
            ArrayList selectors = new ArrayList();
            while( shouldRun )
                selectors.add( Selector.open() );
                Thread.currentThread().sleep(500);
          } catch (Exception ex) {
              ex.printStackTrace();
    }Basically on #4 I want to know why/if running this code wouldn't be a major problem on any system that opens and closes ports for listening regularly. (And yes, aside from the fact that it doesn't explicitly clean up the selectors before exiting.)

    Hmmm ...
    We had an issue in production where one
    of the ServerSocketChannels failed to bind because it
    collided with the wakeup pipe range. Of course, this
    was on Java 1.4.2_02 which binds on the primary
    adapter for the system and not the loopback adapter.This seems back to front. By default Java binds to INADDR_ANY which is all the interfaces, which is why you got the collision on the loopback port which was already there. If it bound the socket to a specific non-loopback NIC there would be no collision with any loopback port, they are different number spaces.
    Are you able to create all the ServerSockets before any of the Selectors?
    or, if your hosts aren't multihomed, is it practical for the application to bind its ServerSockets to the primary NIC (i.e. the non-loopback)?
    Yes, we can repeatedly try to bind on a port and
    d perform other work-arounds, but why should we have
    to? How could we have expected this behavior? (It
    may be a Windows limitation that caused Sun to choose
    their implementation method, but non-Java TCP apps on
    windows don't have these problems...)Agreed, but then again non-Java TCP apps don't try to implement select() for arbitrary numbers of sockets to agree with *nix platforms, they can generally live with <= 64.
    Note: The problem appears exacerbated from having the
    listen ports of these wakeup pipe connections stay
    open for long periods of time (rather than closing as
    soon as the pipe is established). Would this help? There would still be the connected port with the same number & this might inhibit a new listening port with that number. Haven't tried this myself.
    Well, considering the behavior changed between
    1.4.2_02 and 1.5 it can't be all that inaccessible a
    fix. Perhaps using an extra TCP connection was
    necessary in some cases, but obviously binding to
    ("127.0.0.1", 0) isn't the only choice since it has
    changed recently and those values could easily be
    made configurable (given access to the code
    involved).It changed from binding to 0, i.e. INADDR_ANY, in 1.4 to binding to 127.0.0.1 in 1.5, probably in an effort to vacate the port space for the physical NICs.
    Given access to the code involved you can change anything. In the SCSL code it is sun.nio.ch.WIndowsSelectorImpl.java in src/windows/classes.
    Actually, I'm also wondering if a single
    (known-default/configurable) listen port wouldn't be
    adequate for all of these wakeup pipe TCP
    connections. Me too.
    Regards
    EJP

  • BEFW11S4 UDP AND TCP PORT opening

    How do i open UDP AND TCP ports specifically TCP ports: 80, 6667, 28910, 29900, 29920
    UDP ports: 4321, 27900 Its for a networkable game i need to open these ports to play it.

    Ok But when i try disabling the numbers in the forwarding field i run out of spaces in the field to be able to disable them Is there an advanced firewall settings that i dont know about? I put in all of the range forwarding and put the range forwarding start for example 80 originally (TCP ports: 80, 6667, 28910, 29900, 29920
    UDP ports: 4321, 27900) The ones i try to disable i run out of fields to disable them in the forwarding for example there are 10 slots for disabling and Im trying to disable them on two numbers 192.168.1.101. and 192.168.1.100 So i need to disable them for both ip numbers I got 10 fields to enter it into them and 10 x 2 is more than the numbers..... You get me?? and on top of that i dont know if what i did was enough Linksys doesnt want to help me without paying 30 dollars so im just thinking i should buy a new router....... i mean they charge 39 dollars for a new router and they want me to pay 39 dollars for tech support it just doesnt make any sense........

  • Has anyone tried driving two external monitors (3 total displays) on the iMac 2011 through the thunderbolt ports on Windows 7 Bootcamp?

    I would love to purchase an iMac 2011 with the Thunderbolt ports, but I need to occasionally boot to Windows 7 Bootcamp.
    I imagine this will work in general... but has anyone tried driving two external monitors using the Thunderbolt ports in Windows 7 Bootcamp?
    Thanks in advance!
    Ralph

    Hi,
       I am trying to get this working at the moment. both monitors are fine in Lion but I am losing the second monitor in windows. I will update you when I get it working.

  • How can I use the USRP to record a signal using its two RX port simultaneously?

    Hi.
     I am trying to record a signal using two horn antenna. The reason I need two antenna is to cover the wide frequency range (DC-6GHz). one antenna is covering DC-300MHz and the other one covers 300MHz-6GHz. So I need to use two RX port of USRP at the same time to record the signal. I have two questions:
    1. Does any USRP in the market capable of covering this range of frequency?
    2. Is it possible to use both RX port at the same time to record signals as I described? If not, how can make that happen?
    P.S. I have two NI2920 USRPs and two N210 USRPs in my lab. 
    Thanks in advance for your time.
    Sam.
    Solved!
    Go to Solution.

    Hi Sam,
    To answer your first question the USRPs that you have cannot reach the frequency range that you want. There is not a USRP, to my knowledge, that can reach this range in one device. 
    Also note that you cannot use two RX sessions for two different ports at the same time using LabVIEW and the USRP driver. If you want to use both RX lines you will have to run one session with one line, end the session, and then start a different session for your second RX line.
    Noah | Applications Engineer | National Instruments

  • Always on Availability groups using static SQL Tcp Port

    Hi,  I have 2 SQL 2012 servers in my DMZ and I have assigned SQL to run on a static TCP Port.  I would like to setup Always On availability groups on the servers but I cannot get the failover to work with the static TCP port.  It works fine
    with dynamic ports.
    When the failover is initiated it attempts to connect to the secondary replica with out using the static port,  can someone tell me how to setup the availability group using static tcp ports.
    Thanks,

    When I setup the secondary replica I added the port number, but it doesn't appear to use it for failover.  I add the secondary replica w/o errors.
    I am not sure how to add the port number to the primary.
    Dave
    Hi Dave,
    Based on your description, could you please post the error message when getting failover to the secondary replica?
    In addition, If you use the default port of 1433 for availability group listener VNNs, you will still need to ensure that no other services on the cluster node are using this port; otherwise this would cause a port conflict.
    If one of the instances of SQL Server is already listening on TCP port 1433 via the instance listener and there are no other services (including additional instances of SQL Server) on the computer listening on port 1433, this will not cause a port conflict
    with the availability group listener. However multiple instances of SQL Server (side-by-side)should not be configured to listen on the same port.
    For more details, please review this article:
    Availability Group Listeners, Client Connectivity, and Application Failover (SQL Server).
    Thanks,
    Lydia Zhang

  • Using separate ethernet ports for LAN and internet

    Following scenario:
    A couple of Lion clients and a Lion server connected to a switch. Switch connected to router for internet access. All devices, clients, server and router are in the same C-Class net.
    I'd like to connect the Lion server with 2 ethernet ports to the switch, so that one port is solely used for connections to the Lion clients (aka LAN) and the other port is solely used for connections to the internet. That way heavy LAN traffic to/from the server cannot bog down internet access to the server. Any ideas how to acomplish that?
    Usually you would configure the Lion server as a router and connect the Lion clients (via a switch) to one port and the cable modem to the other, so both ports are in different subnets. But I don't want all internet traffic from the clients going through the Lion server.
    The best I've come up so far was to configure both ethernet ports with static IP addresses. The one connecting to the clients with a 255.255.255.0 netmask but no router IP given. The one for internet with a 255.255.255.255 netmask and the router IP set to my physical router IP. It seems to work, but I'm not sure, whether this is the suggested way to do such a setup.
    Maybe some manual editing of the routing table is are more solid solution?
    Any tips appreciated.
    Pete

    What you want to do can be done but maybe not the way you are trying.
    First yes, you would use two Etherner ports on the Mac, if it is a Mac Pro or XServe it has two built-in, other Mac models can do this using a USB Ethernet interface.
    Next, the way I would normally do this is to have a separate switch for the WAN router, this would make the setup look like the following
    LAN Switch ----- Server ------------ Router --- Internet
           | |                             |
           | |                            NAT    
           | +-----------------------------+
           |
           +------ Client Devices
    The router could be doing NAT via one interface, or a separate Firewall box could do the NAT.
    Another possible way would involve segmenting the lan switch by setting up a VLAN and putting one port for the Servers second Ethernet connection on to that VLAN (using public IP addresses and the a connection to the router on that VLAN, the LAN switch could then route between the two VLANs. Cheaper LAN switches do not have this ability.

  • Comm with rt system using two ethernet boards

    I am using two ethernet ports in my host computer.  One for LAN communications and the other as a link to my PXI RT system.  I've not been able to establish comms with the RT system.  Any suggestions?
    Steve Hall
    [email protected]

    I found a cable causing the problem.  With correct cable MAX recognized the remote PXI embedded controller and all is fine. 
    Steve Hall
    [email protected]

  • RT: How do I use two independen​t Ethernet ports?

    I have looked around at the forums and seems like no one has had a real solid answer or example on how to use 2 Ethernet ports with RT.
    Right now I have two connections configured on the RT:
    Primary Connection:
    IP:192.168.2.181
    Subnet mask: 255.255.255.0
    Gateway: 192.168.1.1
    DNS Server: 192.168.1.1
    Secondary Connection:
    IP:192.168.1.180
    Subnet mask: 255.255.255.0
    Gateway: 192.168.1.1
    DNS Server: 192.168.1.1
    After using this initial setup, I made a RT project where I used 'UDP Open' for both 192.168.2.181 and 192.168.1.180, and had them both read and write in a sequence (Read and Write for the 2.181 connection, then Read/Write for 1.180).
    The computer I'm using to send the data is connected to a switch, which in turn is connected to the RT. Both the RT and my host computer have 2 ports, one of them with ports configured to be 192.168.2.x and 192.168.1.x
    Using this configuration I get some weird results:
    If I send a packet to 192.168.2.181, I receive it from the UDP Receive vi that has an input connection from my UDP Open assigned to 1.180. I also receive the data the same way when sending packets to 1.180 (as expected). Basicly, no matter what IP I'm sending it to on the RT, the data from either packet will arrive from the same location/vi.
    Why is this? Is there anyway to fix this? Did I not configure something correctly?
    Does anyone have an example of dual Ethernet ports actually working with LabView RT?
    I tried checking out "KnowledgeBase 3VQ6278T: Can I Use Multiple Network Adapters in a PXI or Desktop Real-Time System?", but after following the link to the page, I get:
    "Error You are not authorized to view this document". Can any NI people look into this?
    Having to make two IPs with different subnet masks obviously just makes things unnecessarily complicated. Can anyone tell me why LabView/NI did this? I know for a fact this isn't a limitation in hardware.
    Any help would be greatly appreciated, thanks!

    Hey Weizbox.
    Sorry to hear you're having such a difficult time using multiple ethernet devices with RT. 
    Let me go ahead and get the easy stuff out of the way, the link you
    have is dead because it's archived (and thus removed forever) though
    unfortunately the link on ni.com wasn't corrected to point to the
    following resource, which the KB was a word-for-word duplication of
    (which is supposedly why it was removed):
        http://zone.ni.com/reference/en-XX/help/370622C-01​/lvrthelp/configuringdual/
    Unfortunately, though, it's much less useful than it sounds.
    Before you start feeling like a woodpecker in a petrified forest, lemme
    fill you in on why the requirement is there for the two ethernet NICs
    to be on seperate subnets.  Simple enough, it has to do with the
    network stack on both of the operating systems used for LabVIEW
    Real-Time - however, the same falls true for even Windows (without
    using fancy vendor-specific drivers), so let's not be too hasty. 
    Neither PharLap ETS nor VxWorks, the two OS's used under the hood,
    support redundant network ports.  Because of this, if you give two (or
    more in the case of PXI and RT Desktop) ethernet devices IP addresses
    on the same subnet the routing tables in the network stack get horribly
    confused and literally cannot resolve the proper adapter, which either
    brings down the ethernet on the entire system or makes it such that one
    or more network adapters becomes useless and one adapter takes over all
    network traffic (there's no way to predict which adapter that will be,
    nor can you control it based on what's plugged in and what's not).  On
    Windows this is handled by bridging the adapters, but RT does not yet
    support bridging (that opens a whole nother can of worms).  Long story
    short, you still wouldn't be able to give both NICs individual IP
    addresses on the same subnet. 
    Let's take that even one more step.  You cannot simply just assign both
    ethernet NICs different IP addresses on "virtual" subnets, you actually
    need to put both NICs on literally different subnets for the network
    routing to actually work.  Multiple ethernet devices for LabVIEW RT
    were designed with the following mantra in mind - "The FIRST ethernet
    device is designed for a TCP/IP network, the SECOND and SUBSEQUENT
    ethernet device is designed for OTHER protocol uses."  By "OTHER
    protocol uses" I mean the second NIC should be used for RT
    Deterministic Ethernet (PXI, RT Desktop, et. al.), direct connections
    with other targets, and 3rd party or custom ethernet protocols. 
    Now, realistically, we can't expect users to not use the second NIC for
    TCP/IP use, nor should we.  However, if you ARE going to use TCP/IP on
    the second NIC, you should only use the second NIC for connecting to an
    unroutable network in the eyes of the first NIC.  So, for instance, the
    FIRST NIC can have an IP address of 10.0.62.128, but the SECOND NIC
    would need to have an IP address on 192.168.100.23  - and the
    10.0.62.128 should not be able to route a TCP packet to the 192.168.x.x
    network, and vice versa.  In your example I noticed that both networks
    used the same Gateway - unless your Gateway is configured to identify
    and seperate the two networks, it's not going to end well, and you
    shouldn't expect to be able to send data from one NIC to the other NIC
    (at least with what you know now).  To reiterate, using multiple NICs
    using TCP/IP should only be done in cases where you've got (n-1)
    isolated subnets, where n is the number of NICs you have using TCP/IP. 
    A classic example of this is a command-based measurement environment;
    the RT system uses the FIRST NIC to talk to a TCP/IP network, in order
    to transfer data or provide status to a network, and the second NIC is
    connected to a TCP/IP network designed specifically for measurement or
    control, where one node sends commands to a single or multiple nodes on
    the network at once to perform tasks (like "Take a Measurement", "Stop
    a motor", "Bake me a Pie", etc...).  The isolated TCP/IP subnet is free
    from "random" TCP/IP traffic (especially system announcement
    broadcasts) and can have whatever topology/configuration it wants.  The
    dual networking allows the RT system to work/communicate/perform on
    both networks.
    I hope this helps shed some light on your situation.
    Cheers!
    -Danny

Maybe you are looking for