Able to bind to the same port on twice with  setSocketOptionReuseAddress

Hi,
I am not sure wether it is bug in API or lack in understanding.
I have a server , using Java networking API and I have set "setSocketOptionReuseAddress(true)" for "java.net.ServerSocket". Now I am able to start more than one instances of server with same port and IP.
If I set "setSocketOptionReuseAddress" to false. second instance won't start an throws 'Address in user : bind exception".
setSocketOptionReuseAddress is supposed to help only in socket "TIME_WAIT" situation, why is bind getting effected by this?

I assume the original poster is on Windows in which case the SO_REUSEADDR socket option has different semantics for streams socket compared to other platforms. As the poster says, it allows multiple servers to bind to the same socket. Assuming this is a ServerSocket then the simplest solution would be not use setReuseAddress -- ie: leave it as its default value and everything should be fine. On Windows you can re-bind when a previous connection is in TIME_WAIT. On other platforms (Solaris/Linux anyway), the SO_REUSEADDR option is enabled by default for ServerSockets so the server can be restarted even if there is a connection in TIME_WAIT.

Similar Messages

  • How do I open the same ports on an Airport Extreme Base Station for multiple computers at the same time?

    As the title suggests...
    I have a mix of five Mac and PC's at home using an Airport Extreme Base Station as the router.   I need many ports opened on the AEBS for all of the computers- not just one computer.  (for example: three people want to play TF2 on Steam at the same time; each machine needs the correct ports open on the router).   Port forwarding  only allows me to forward a given port to a single IP, yet I need that port open for five differnt IP's, all at the same time. 
    How do I do that on an AEBS?
    In the same way, I have a small office of four iMacs using an old airport with the same exact issue.   I would like to be able to connect to all of them remotely with Apple Remote Desktop, but the port forwarding on the airport only allows a port to forward to a single IP.   I want to be able to tunnel into the office network and log onto any machine behind the Airport extreme... not just a single IP.    I currently have it set up where I can tunnel into the office from my house, I can find the one machine that the port forwarding has been assigned to, I can log on and everything is just fine... with one machine.    How do I open the firewall for the other machines? 
    TL,DR version:  How do you open ports on an Airport Extreme Base Station instead of forwarding ports?   Forwarding ports doesn't work for multiple IP's.  

    You can open a single or multiple ports to a single device or different ports to different devices, but you cannot open the same port to multiple devices via the AirPort Utility for the Apple routers.

  • Multiple repeating SubForms binding to the same data node

    Having multiple repeating SubForms binding to the same data node : In our documents, many times we need to display information from same table in multiple locations. For example, if document displays information of Insureds on one page and information of drivers on another page, we need to create a LiveCycle document with two SubForms. Each SubForm needs to have a repeating binding to CommonInsured element in XSD.  LiveCycle Designer is not able to handle such case. We cannot have two subforms bound to the same node, ONLY in a case where repeating option is selected for data binding.
    The only way I have found out is the following Javascript
    //Get the data node from XML. You will find the code for this function in //JavaHelperFunctions library.
    // InsuredDataRepeatingSubForm is a second subform.
    //You need to manually add instances to this subform at the
    //runtime and Insured data to each instance.
    var insuArray = JavaHelperFunctions.getInsureds();
        var i=0;
        for( i=0; i<insuArray.length; i++)
           if (i>0)
    var thesubform = this.InsuredDataRepeatingSubForm.instanceManager.addInstance(i);
                  thesubform.InsuredName.rawValue = insuArray[i].fullName.value;
           else
                   this.InsuredDataRepeatingSubForm.InsuredName.rawValue = insuArray[i].fullName.value;
    Is there any way I can achieve directly using bindings since we are trying to minimize javascript that changes the layout of the form?
    Thanks in advance!

    Unfortunately not. I've spent countless hours/days trying to do the same thing. You have to use code. The form consumes all the data it can into the repeating elements until there is none left and it is not reused.
    Here's a function I wrote just for that purpose. Feel free to use it:
    function loadData(source,target){
    target.setInstances(source.count);//set the target's subform instances to match the source's
    for (var a=0;a<source.count;a++){//loop through each subform instance
      var sourceSubform=source.resolveNode(source.name.substr(1)).all.item(a);
      var targetSubform=target.resolveNode(target.name.substr(1)).all.item(a);
      for (var b=0;b<sourceSubform.nodes.length;b++){//loop through the children of each
       if (sourceSubform.nodes.item(b).className=="field" && targetSubform.resolveNode(sourceSubform.nodes.item(b).name)!=null)//check for matching fields
        if (typeof(targetSubform.resolveNode(sourceSubform.nodes.item(b).name).value.exData)=="undefined" ||
         typeof(targetSubform.resolveNode(sourceSubform.nodes.item(b).name).value.exData.body)=="undefined")
         targetSubform.resolveNode(sourceSubform.nodes.item(b).name).rawValue=sourceSubform.nodes.item(b).rawValue;
        else
         targetSubform.resolveNode(sourceSubform.nodes.item(b).name).value.exData.loadXML(sourceSubform.nodes.item(b).value.exData.saveXML(),1,1);
       if (sourceSubform.nodes.item(b).className=="instanceManager" && targetSubform.resolveNode(sourceSubform.nodes.item(b).name)!=null)//check for matching subforms
        loadData(sourceSubform.nodes.item(b),targetSubform.resolveNode(sourceSubform.nodes.item(b).name));
    Just make sure the source and target subform hierarchies are identifal, same name and all. It will recurse down the tree and transfer source fields (rich text and plain) to their sister targets.
    Kyle

  • Can you do Digital In or Out on the same port (byte) as PFI timing?

       I'm using an M series board with three digital ports.  Port 0 is only for DIO, ports 1 and 2 can be used for DIO or PFI (e.g. clocking, triggering).  My question is:  can I do both DIO and PFI functions on any one port.  For example, on Port 1, I would like to use bits 0 to 6 as Digital Inputs and have an external clock signal go into bit 7 as a clock for Analog Out.  Can the port be mixed like this?
    Thanks,
       Dave
    David Thomson Original Code Consulting
    www.originalcode.com
    National Instruments Alliance Program Member
    Certified LabVIEW Architect
    There are 10 kinds of people: those who understand binary, and those who don't.

    Dave,
    The DIO lines on any DAQ device that uses the DAQ-STC ASIC can be configured on a per line basis, so using PFI and DIO lines on the same port will work just fine. 
    You can run a quick test on this using the "Gen Dig Pulse.vi" example (found in the NI Example Finder under Browse -> Hardware Input and Output -> DAQmx -> Generate Digital Pulses).  You should be able to generate a pulse on one of the PFI lines on the board, then read that pulse back in on one of the DIO lines of that port using an external connection.
    -Justin

  • Broadcast and point to point server in the same port

    I'm trying to set up a system where I can send point to point messages via sockets to certain ips, send broadcast messages to every pc in the network, and also be able to listen for point to point messages and broadcast messages, all in the same port. I've been able to establish a point to point connection using the Socket class to send the message, and using the ServerSocket class to listen for messages, but I can't seem to get broadcasting to work.
    I read somewhere that for broadcasting one should use the DatagramSocket class. The problem is i'm not sure which ip i'm supposed to specify when I send the message. Also, do I need a special listener to listen for broadcast messages, or will the ServerSocket listener work for that?
    This is what I have for the broadcasting part:
    String msg = myId;
    DatagramSocket sendSocket;
    sendSocket = new DatagramSocket(Constants.COM_PORT); // 4567
    InetAddress group = InetAddress.getByName(Constants.BROADCAST_ADDR); // "192.168.1.1"
    DatagramPacket dp = new DatagramPacket(msg.getBytes(), msg.getBytes().length, group, Constants.COM_PORT);
    sendSocket.send(dp);
    sendSocket.close();
    Thanks in advance
    Diego

    It worth mentioning that UDP/broadcast and robust do go together easily.
    - UDP does not guarantee delivery. i.e. messages can be dropped and you won't be told. Lost packets are not retransmitted either.
    - UDP can fragment packets if larger than 532 bytes long.
    - UDP packets can arrive out of order (though I have never seen this myself)
    If your receiver is under load/busy it can miss many packets if its buffers overflow.

  • Two computers connected in the same port dot1x in 3750 in different time.

    I have the following consultation.
    I have a "computer A" connected to a port of switch 3750, configured with: dot1x port-control auto
    dot1x timeout quiet-period 5
    The "computer A" is authorized.
    When I disconnect the "computer A" and I connect a "Computer B", this is not connected, but when I connect the "computer A" again if is connected.
    How many time I should expect to be able to connect the "computer B" in the same port of the 3750?

    When the switch cannot authenticate the client, the switch remains idle for a set period of time and then tries again. The dot1x timeout quiet-period interface configuration command controls the idle period. A failed authentication of the client might occur because the client provided an invalid password. You can provide a faster response time to the user by entering a number smaller than the default.
    The value after the quiet-period is in seconds, so in your case, the switch will wait five seconds before it re-tries for another authentication for the new device connected.
    Please rate helpful posts.

  • Can you have multiple RMI Servers listen at the same port?

    Hi,
    I am wondering if is possible to assign many RMI servers to the same port. I have a working RMI system that is assigning a single server to a specified port when the server is created. I need to scale my project to incorporate Activation and the ability to go through a firewall. I have the power to punch holes in the firewall, so I am thinking that I would like to set up a port for all my activated servers to listen on. Is this possible to put them all on one port?

    Yes you are correct. However, I am wanting the actual servers listening on the same port. I have noticed that when I do not assign a port number when binding my RMI servers to the registry, then the rmi system sets them all up listening on the same port. This port is random and changes each time I restart my server system, which rebinds all the servers to the rmiregistry again. I am look for a way to use custom socket factories and then tell the servers the exact port to listen at. I keep getting port already in use issues though when I try to assign more than one server to a particular port. I don't know if this is even possible. Has anyone ever gotten this to work?

  • Several process listening to the same port number

    I hope I am in the right form (it's the third one I am trying).
    I have server/client application, one server that handles a lot of clients. In general when ever a client approach the server, the server create new process (fork()) that handle the client request.
    I would like to know if there is a problem that several processes (parent and several child processes) are listening to the same port number, is it better to create thread that would handle the client request, instead of creating a child process?
    To better understand the problem I create very simple client and server application.
    This is a part of the server application:
    The server creates a socket, bind to this socket and then listen to this socket.
    After that in a while (1) loop he waits for accept:
    int sockclient = accept(sockId,(struct sockaddr*)(&client_addr), &addrLen);
    When the server get a sockclient (client ask for service) he create new process (fork()) that handle the client request.
    struct sockaddr_in addr, client_addr;
    bzero(&addr,sizeof(struct sockaddr_in));
    addr.sin_family = PF_INET;
    addr.sin_port = 8865;
    bcopy(ent->h_addr_list[0],&(addr.sin_addr), ent->h_length);
    // bind
    bind(sockId,(struct sockaddr*)(&addr), sizeof( struct sockaddr_in));
    If it would help I can add the all code.
    If you knows about articles that talked about this subject It might help too (I am talking about advantages and disadvantages of thread against process but regardless of sockets).

    You might look at this article
    http://httpd.apache.org/docs-2.1/misc/perf-tuning.html
    under the section "accept Serialization - multiple sockets".

  • Allow Multiple Computers Access To The Same Port

    I just received my AEBS in the mail this afternoon & set it up in no time. My college house has two Xbox 360s connected to the AEBS & I would like to open the NAT ports on both. I'm able to successfully forward the ports to allow an open NAT for one Xbox, but the Airport utility doesn't allow me to open the same ports for the other Xbox.
    Is there a way to open a port to everyone connected to the router, or maybe a way to open a specific port used by multiple Private IP Addresses?

    Sorry, but no. Port mapping forwards inbound a single, or range, of ports (in one definition) to one single machine only. So, for example, you could not map port 25 to multiple email servers on your LAN. However, you could map port 25 (for email) and port 80 (for web) to a single device.

  • Reading the same port on the same machine

    Hello,
    i'm working on DatagramSocket to broadcast DatagramPacket (IP 192.168.xxx.255) and a fixed num port. The problem is that I can't have 2 threads that read (datagramSocket.read) on the same port, on the same machine.
    How can I perform my tests ?
    java.net.BindException: Address already in use
    at java.net.PlainDatagramSocketImpl.bind(Native Method)
    at java.net.DatagramSocket.bind(DatagramSocket.java:368)
    at java.net.DatagramSocket.<init>(DatagramSocket.java:210)
    at java.net.DatagramSocket.<init>(DatagramSocket.java:261)
    at java.net.DatagramSocket.<init>(DatagramSocket.java:234)

    Well, the short answer is that you can't.... at least I've never heard of a way how. Basically, when an application requests a port number, it basically owns that port number until it gives it up. You do this when you create the DatagramSocket. Each DatagramSocket is its own request, and therefore must have an unique identifying port. Otherwise, how would your operating system know who to give the data to when it receives a packet on your machine for port XXXX? Also, it would be a secuirity problem if other applications could listen on the same port as you use for other things like surfing the web, making online purchases, email.
    However, what you could do is have one owner of the DatagramSocket... and share it among the other threads. When that owner receives a packet, it can notify the other threads it received a packet and pass the data to each one. Set it up something like how listeners work. Also, if you want it to span processes, you could use RMI or pass the data through other deined network connections between the processes.
    Does that make sense? :)

  • RV130W: 4 devices need to use the same ports.

    I just started a video game streaming business and have 4 video game consoles connected and able to play online at the same time on my recently purchased Cisco RV130W.
    There's only 2 games currently that we are streaming but NAT seems to be a really big issue and is causing connection problems.
    I've tried leaving this in the hands of UPnP but it seems that this is an issue that cannot be resolved so simply.
    All 4 consoles are Sony PS4s and to connect and play online I need them all to have access to the following ports:
    TCP Outbound
    TCP Inbound
    UDP Outbound
    UDP Inbound
    80, 443, 1935, 3074-3077, 3478-3481,7500-17899, 10040-10060, 30000-40399
    80, 443, 1935, 3074-3077, 3478-3481, 9293, 10040-10060
    2001, 3074-3077, 3478-3481, 6000-7000, 10070, 50000-60000
    2001, 3074-3077, 3478-3481, 6000-7000, 10070, 50000-60000
    At best, I've got a NAT Type 2/Moderate... at worst, I can't even connect.
    To answer any questions that may be coming up or rule out any suggestions I have already tried...
    All devices on the LAN have a static DHCP address.
    Only one console works perfectly with UPnP.
    The DMZ can fix one console but makes the NAT or the other 3 unusable.
    You can't forward the same ports to 4 different devices so I have to rule that out.
    Port triggering doesn't work because [I am guessing] the TTL on the packets must be too long and is still hogging the ports while other consoles are trying to send data.
    I made a separate VLAN20 for the consoles so I could unblock all outbound and inbound traffic with a firewall rule and that didn't fix it.  ...that's why I think this is a NAT/PAT issue.
    I used to be able to get 2 consoles working with my Asus RT-N56U using only UPnP.
    All help is appreciated.  I will provide whatever other info you need.
    Thank you in advance.

    UPnP seems to be implemented very differently with the vendors
    I would see if disabling the following on the firewall helps under Basic Settings
    as they may also be part of the issue, 
    I know that Xbox Live likes to be able ping the wan IP, as for the PS I'd bet things are similiar
    DoS Protection
    Block WAN Ping Request
    IPv4 Multicast Passthrough:(IGMP Proxy)
    IPv4 Multicast Immediate Leave:(IGMP Proxy Immediate Leave)
    UPnP Allow Users to Configure
    UPnP Allow Users to Disable Internet Access
    I know that Open Nat for Xbox is something you don't actually want,
    as the ones who have open nat end up getting all the traffic, and they are the ones that get laggy
    Unless the game they are playing has to be the server host there is no choice for the most part
    Also, on most routers in regards to gaming, I've found that one should use UPnP or Port Triggering, but not both at the same time

  • Installing 2x Instances of UCM on the same ports on a multihomed server

    We're looking at installing 2x instances of UCM on the same multihomed server, using the same port numbers for each.
    But following the initial installation, we note that the admin port binds to all of the IP's in the server.
    $ netstat -a | grep LISTEN | grep 444
    tcp 0 0 *:4440 *:* LISTEN
    Is there a way to stop the Admin server from doing this, and only to bind to a single IP ?
    We effectively want to get the 1st instance Admin Server to Listen on IP1:4440
    And the 2nd instance Admin Server to Listen on IP2:4440
    Same with port 4444 for both instances.
    Incidentally, the Admin Server should not really listen on all IP's by default, as this is a potential security risk especially if one IP was for example internal traffic, and the other one was for external traffic.
    So there are other reasons for not wanting to listen on all IP's within the server rather than the specific one.
    Any help / guidance much appreciated.
    Regards
    Andrew

    This configuration entry is available:
    IdcServerBindAddress=IPaddress
    It's generally been used in clustered installations but I see no reason why it wouldn't work with a stand alone instance as well.
    Regards,
    Josh

  • Can two different local ips use the same port at the same time?

    Can two PS3s use the same ports at the same time. So let's say you have two PS3s and they need to open the exact same set of ports at the same time to be able to play the same game online. Is that possible on a regular consumer router such as the wrt310n? If so, then how would someone go about that. I am just asking out of curiosity.
    I don't work for Cisco. I'm just here to help.

    Use port range Triggering instead of Port forwarding. When you use port triggering then those ports will be opened for the entire local network.

  • Is it possible to use both an ILB and an ELB (listening on the same port) in the same Azure cloud service?

    I'm building a test Lync deployment on Azure; yes, I know this is not supported, hence "test".
    Lync Front-End servers expose two set of web services, one for internal users and one for external ones; they listen on different ports (443 and 4443) on the same servers; when external services are published, you need a reverse proxy or a port forwarding
    in order to map port 443 of a public IP address to port 4443 of the Front-End server(s). When you have multiple Front-End servers in a pool, you also need to load-balance them.
    So, a typical Lync deployment looks like this:
           Internal users
                     |
                   443
                      |
              Internal LB
            192.168.0.20
            443         443
              |               |
       Lync FE 1     Lync FE 2
    192.168.0.21 192.168.0.22
              |               |
          4443        4443
              External LB
           Public IP Address
                     |
                  443
                     |
           External Users
    This should be easily replicated in Azure, as it supports both external load balancing and internal load balancing. They are even supported together in the same cloud service, so this configuration should be easy. However, it looks like "should"
    is the keyword here.
    After creating the external load balanced endpoint (which listens on external port 443 and forwards to port 4443 on the servers), I'm trying to create an internal load balancer and add internal endpoints to is; however, while the ILB can be created successfully,
    adding an internal endpoint listening on port 443 and forwarding to port 443 on the servers fails miserably, with an error stating that port 443 is already in use by another endpoint:
    Update-AzureVM : BadRequest : Port 443 is already in use by one of the endpoints in this deployment. Ensure that the port numbers are unique across endpoints within a deployment.
    For reference, my commands are:
    Add-AzureInternalLoadBalancer -InternalLoadBalancerName "LyncILB" -ServiceName "LyncFrontEnd" -SubnetName "LabSubnet" -StaticVNetIPAddress 192.168.0.20
    (This completes successfully)
    Get-AzureVM LYNCFE1 | Add-AzureEndpoint -Name "Https-Int" -Protocol "tcp" -LocalPort 443 -PublicPort 443 -LBSetName "HttpsIntLB" -DefaultProbe -InternalLoadBalancerName "LyncILB"
    (This fails)
    The existing external endpoint is configured as such:
    Get-AzureVM LYNCFE1 | get-azureendpoint
    LBSetName : HttpsExtLB
    LocalPort : 4443
    Name : HTTPS-Ext
    Port : 443
    Protocol : tcp
    Vip :
    ProbePath :
    ProbePort : 4443
    ProbeProtocol : tcp
    ProbeIntervalInSeconds : 15
    ProbeTimeoutInSeconds : 31
    EnableDirectServerReturn : False
    Acl : {}
    InternalLoadBalancerName :
    IdleTimeoutInMinutes :
    LoadBalancerDistribution :
    The error doesn't even make a lot of sense; the external load balancer listens on a public IP address, while the internal load balancer listens on a private IP address in the internal network; there
    shouldn't be any conflict here... however it looks like there is one instead.
    Why doesn't this work? Am I doing something wrong, or is Azure networking just being silly as usual again?

    Hello Massimo Pascucci,
    The issue that you are facing when creating an endpoint with internal loadbalancer is the limitation of not allowing same ports to be listening under a single cloud service. This reason for this is that there is a limitation of only one private IP (Also
    known as the Internal load balanced IP) per cloud service.
    There is also a limitation on the Internal load balancer more than one port to be published per load balancer:
    You can leave your feedback by following the link below:
    https://social.msdn.microsoft.com/Forums/en-US/1805c5a0-3906-4cd6-8561-9802d77e0ae5/is-it-possible-to-use-both-an-ilb-and-an-elb-listening-on-the-same-port-in-the-same-azure-cloud?forum=WAVirtualMachinesVirtualNetwork
    Refer to this article for more information on Internal load balancer:
    http://azure.microsoft.com/blog/2014/05/20/internal-load-balancing/
    Thanks,
    Syed Irfan Hussain

  • I have recently upgraded to OSX 10.8.2 and now find that I cannot operate my scanner, an hp psc 1310 series printer/scanner. I get a message saying that Power PC is no longer supported. I am still able to print on the same device. What should I do?

    I have recently upgraded to OSX 10.8.2 and now find that I cannot operate my scanner, an hp psc 1310 series printer/scanner. I get a message saying that Power PC is no longer supported. I am still able to print on the same device. What should I do?

    Hi,
    PSC 1315 no longer supported for scanning since Mac OS X v10.5 or while using any newer OS, there is no scan software provided by either HP or Apple (Image Capture)
    You may find this information stated below for Leopard, the same apply for any newer OS version:
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c01234231&cc=us&dlc=en&lc=en &os=219&product=374568&sw_lang=
    Image capture will not recognize your device as well, only print is supported as you may find listed for teh PSC 1310 Series below:
    http://support.apple.com/kb/HT3669#HP
    Although there is no official scanning support for your device you may still try the 3rd party VueScan software which list your scanner as supported and compatible with Mountain Lion:
    http://www.hamrick.com/vuescan/hp_psc_1310.html
    Shlomi

Maybe you are looking for

  • What's Wrong? My iPad Lost it's Yellow Tint!

    My new iPad never really had a yellow tint. The display, though, was obviously warmer in tone than my iPad 2, and the warmth was across the entire display, not just part of it. Space around text was, in particular, whiter on the iPad 2, and the text

  • Issues in posting payment advcie through idoc.

    Hi  I am using PEXR2002 IDOC type for creating payment advice. for that i need the segment E1EDP02 to be repeated five times for different fields with diff qualifiers. it is giving me syntax error- this segment cannot be used more than 4 times. pleas

  • Full screen preview with one monitor

    Hello, I'm using Premiere Pro CS5 on a Mac with a single monitor. I would like to see the full screen preview on this monitor, hiding all GUI elements. By reading around, I could only find the suggestion of selecting the Preview pane and press the ~

  • Struts class not found for war file

    Hello, I am tring to deploy my struts web application in weblogic 8.1. I have all the library files in web-inf\lib directory. It gave me the error that class not found for some class in struts library. The console also told me the classpath. But I ca

  • Blocking of gl accounts

    Hi I need to block the GL accounts from 410000 to 410500 apart from blocking in gl master while posting. SAP_CIN Moderator: Please, avoid asking basic questions