Strange behaviour: two servers on the same port

Hi!
I hope this is the right section for this post. I need help about a strange behaviour involving a ServerSocket.
For my thesis I need to write a program that receives data from a pre-existing DSMS client, filters them and then sends them to a pre-existing DSMS server. And here is my problem: if I try to create a ServerSocket on the same port of the DSMS server, my program throws no exception, and the servers seem running on the same port. This is a behaviour that I'd like to avoid, but I cannot understand what the problem is. Can you help me?
The source code of the DSMS server can be found here (it's written in C++): http://infolab.stanford.edu/stream/code/stream-0.6.0.tar.gz
The source code of my server class, instead, is this one:
import java.io.*;
import java.net.*;
public class ThreadGenerator {
     private ServerSocket server;
     public void connect(String servPort, String cHost, String cPort) {
          try {
               server = new ServerSocket(servPort);
               System.out.println("SERVER running on port "+servPort);
          } catch (BindException e) {
               System.out.println("Address already in use!");
          } catch (Exception e) {
               System.err.println(e);
          try {
               while(true){
                    Socket client = server.accept();
                    StreamThread T = new StreamThread(client, cHost, cPort);
                    T.start();
          } catch (EOFException e) {
               System.out.println("Server closed connection!");
          } catch (Exception e) {
               System.err.println(e);
}I'm programming on Mac OSX Tiger, with Java 1.5.0.
Thanks in advance for your help.

The problem is still happening to me, I tried in this very moment. The code I'm using is the one I posted, and the second server is the one that I linked. I don't think there's anything else to add.
If you're sure that the problem is not in my code, then it means that it is in the linked server, which partially solves the problem. But I'd like to know, if it's possibile, if there is any other way to check if the port is already in use.

Similar Messages

  • Singletons running on two servers at the same time

    Hello,
              we faced one interesting situation with our application, running on clustered BEA Weblogic 9.2. We implemented some Singletons (ie. Singleton Service in a Weblogic cluster) and they are running fine. Most of the time.
              Common scenarios: cluster is started -> the singletons run on one server; the server is brought down -> the singletons are started on the second server.
              However, we had recently two situations where the Singletons started on both servers! Here they are:
              1) We use Database Migration Basis and we have a dedicated table for Weblogic to capture current state of the singletons. Due to the fact that database (Oracle RAC) was partially available one of the Managed Server could not get the lease and probably assumed that no singleton is running, therefore started the singletons locally.
              2) Network outage: we had several minutes where none of our servers could communicate between them (neither between SASU MS nor with the database). Consequence: each MS decided to start the singleton locally (after some time, which I assume is the waiting time). Once the network came back the servers could communicate again but the duplicate singletons are not deactivate, so they are running in parallel.
              Anyone experienced the same or similar issues? How to prevent the above? Is the Consensus Migration Basis a better choice? (I think yes for #1 but not for situation #2).
              Any helpful answer is appreciated.
              Thank you, best regards,
              Remus.

    In general its not a good idea.  Running PSConfig will try to establish a lock on the configuration database.  Doing that from two servers at the same time may cause the update to fail.
    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

  • 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?

  • 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.

  • Running PSConfig on multiple servers at the same time

    Hi - we are updating an 8 server farm with a CU and in order to reduce downtime I am wondering whether it is supported/risky to run PSConfig on multiple SharePoint servers at the same time
    I plan to run the first one by itself - then after that set 7 off at the same time
    In the past I have always run them serially just to be cautious but there is pressure to reduce downtime so I want to know if there is any risk in running them simultaneously
    Thanks!
    J

    In general its not a good idea.  Running PSConfig will try to establish a lock on the configuration database.  Doing that from two servers at the same time may cause the update to fail.
    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

  • How to create reports servers with the same name in two nodes in Reports

    Greetings
    We are migrating Oracle Application Server 10g (9.0.4) to a better hardware infrastructure with high availability. We want to provide 2 new Oracle Application Server 10g (9.0.4) in High availability and we want to avoid modify the existing forms and reports code, but the code is looking for a specific reports server name when calling reports, but I couldn't create the same reports server name in the both oas machines, I could create the reports server in only one node. I want to create a reports server with the same name in both nodes but it is not possible. I know that there is a procedure to do that in 10.1,2 (Note 437228.1, How to Create Two Reports Servers With the Same Name in the Same Subnet) but I couldn't find the equivalent procedure in 9.0.4.
    Anybody kwows how to create a reports server with the same name in two nodes using 10g (9.0.4)
    Thanks
    Ramiro Ortiz.

    Hello.
    I applied the patch 4092150 on my oas 9.0.4.2 and I modified my rwnetwork.conf file changing the port to 14022 by following the note "How to Create Two Reports Servers With the Same Name in the Same Subnet? [ID 437228.1]" but I am facing the same error rep-56040 "server already exists in the network".
    When I run osfind command I get the following information (My reports server is senarep and I want to create it on SNMMBOGOAS10):
    osfind: Found 2 agents at port 14000
    HOST: SNMVBOGOAS10.sena.red
    HOST: SNMVBOGOAS09.sena.red
    osfind: There are no OADs running on in your domain.
    osfind: There are no Object Implementations registered with OADs.
    osfind: Following are the list of Implementations started manually.
    HOST: SNMVBOGOAS10.sena.red
    REPOSITORY ID: IDL:oracle/reports/server/EngineComm:1.0
    OBJECT NAME: senarep2
    REPOSITORY ID: IDL:oracle/reports/server/ServerClass:1.0
    OBJECT NAME: senarep2
    HOST: SNMVBOGOAS09.sena.red
    REPOSITORY ID: IDL:oracle/reports/server/EngineComm:1.0
    OBJECT NAME: senarep
    REPOSITORY ID: IDL:oracle/reports/server/ServerClass:1.0
    OBJECT NAME: senarep
    Any Ideas?

  • Two web servers cant use same port forwarding rule???

    I have two web servers, each configured to respond to http reqests on port 80.  I use NoIP service to map a domain name to my router. I create a port forwarding assignment for Server A by selecting the WebServer rule in the port forwarding rule table.  All is fine.  For Server B, I select the same Webserver rule and the router says there is a conflict.
    I don't understand why.  I think the router has enough information to route a http request for Server B by knowing its MAC address, which is different than Server A MAC address.
    What am I missing here???
    I was able to do this on my previous router with DD-WRT.....
    So it would appear the way to resolve this is to assign a different port address to Server B???
    grrrrrrrrrr I hate this router

    You shouldn't have been able to do that on any router.  You have to change the listening port of server 2, to 8080 or something like that, or make one a secure server and run it over 443
    That is a known issue with port forwarding
    Problem #8:
    Same Port in Multiple Rules
    There are some routers such as Linksys, D-Link and many others that do not do any checks if a port is already in another port forwarding rule. A port can only be forwarded to one Computer/IP at a time. So when there are multiples of the same port number the port forwarding rule will not work.
    Here is an example.
    As you can see port 2350 is in 2 rules. The 1st one points to a different IP than that of the 2nd rule. So the router will honor the 1st rule and the 2nd port forwarding rule to port 2350 fails.
    By removing the 1st rule the 2nd one will now work.

  • Two applications wants to read on the same port using Socket

    I have an application running on one machine using TCP/IP socket. The data transfer with the other application on other machine is in ASCII.
    Now I want a new application that can have a copy of data received and sent on the given port, where the previous application is running.
    Is it possible in Java using socket and TCP/IP to have two application reading data from the same port and both can read all the data.

    Even when you don't state the type of app which need to read the data stream (is it a server or a client app???), it's impossible to share a single TCP/IP socket among multiple apps.
    Perhaps the best thing to do is to develop something like a proxy server who listens on the nominated port and provides to contact (if your apps are server ones) or to be contacted (if your apps are client ones) by the desired apps.
    This way, the only job for the proxy is to duplicate the contents of the data stream and make them available to all the apps engaged.
    Hope this helps.

  • HELP!!: Two server application instances could work in the same port?

    Hi everybody!!!
    i have two server application instances over the same JVM and both of them need to get requests from the same port, how can i get this??
    I`m not interested on using RMI, and i wouldn`t like to use sockets, because i have already using XML-RPC, so if you can tell me how can i get this without using sockets nor RMI, please help me...
    I don�t if there any way using threads??
    thanks a lot,
    JCPARRAM

    Two sockets can't be bound to the same port on the same machine at the same time. This means that one application can't have two sockets listening on the same port and that two applications can't each have a socket listening on the same port (no matter what language they are written in, and, if they are in Java, no matter whether they are on the same JVM or not).
    Your only solution is to make one of the server applications listen on a different port.

  • Two R3 servers have the same logical system name?

    Can two R3 servers have the same logical system name present in the same network? We plan to clone our production server and let the clone reside in the same network. The clone is identical with the production server with the same SID, hostname, logical system name, but different IP address.

    Hi
    Check this  [Link|http://help.sap.com/saphelp_nw70/helpdata/EN/da/5990df015b5b43a36f6ce7fa1ee8c0/content.htm]will cleare you doubt
    Regards
    Uday

  • Can't connect two external drives via USB hub to the same port.

    I have two external hard drives connected to my MacBook Air, along with other USB devices, using a powered USB hub. When I connect both external drives to the same port via the USB hub, one of them disconnects with an error message saying it was improperly disconnected. The same thing happens when I connect one of the hard drives and an external DVD drive via the USB hub. The two drives work fine when connected to separate ports. Other USB devices coexist with one of the drives quite happily. Can anyone explain why this is?

    External drives may well require more power than a port can supply. Also, many USB hubs cannot be used for external drives. It's always best to connect an external drive directly to the USB port. If the drive enclosure has a second USB port on it, then you can daisy-chain a second drive to the first, sometimes.

  • Can two java program write to the same port by fetching data from different

    can two java program write to the same port by fetching data from different ports, if yes is thing possible for a 3rd program to get all data (is there any data loss or collision)
    how is this possible

    can two java program write to the same port by fetching data from different portsTwo java clients can connect to the same server port and they can both write to it. However the server will see the connections as two separate accepted sockets.

  • 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.

  • 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

  • Cannot connect two computers to the same game server HELP!

    I have a Linksys WRT54G Router.  I have two computers and I want to be able to use them on the same gaming server.  Unfortunately, the game only have one port, so I can only port forward one of my computers.  How can I configure my router to have two external IP addresses to the server so it won't kick one of my computers out.  Thanks!

    Hi,
    I am in a gaming community and many members have a Linksys at home (but I don't know which kind exactly). Many of us try to connect two computers to the same server (many have a family). It seems it is a common problem that no one can connect two computers to the same game server.
    I have a BEFSR41 V3 Firmware version 1.04.8
    I use fixed IP address and no connectivity problem on Internet.
    I have win XP SP2 on both computer.
    I am using a DSL modem
    I can connect the two computers to two different game servers at same time, but not the same server. Default port for this game is the same for all servers I use. I tried with both port forwarding enabled (in that case one PCs can connect the other not) or not (in the second case, whenever the second PC connects, the first one lose his connection to the server, no mater the order I try to connect my PCs).
    Now the weird thing is that one member in my community just decided to throw away his Linksys router and he bought another brand (which I won't name to remains politically correct). Now, without changing anything in his PCs or his connection type, he can now play with two PC on the same server.
    I am seriously thinking doing the same move. Since more and more game are now using Internet (and servers that controls piracy, $$) and family want to play together, not being able to connect two PCs on the same game server makes Linksys in bad situation from marketing point of view.
    For example, in my gaming communtity, we now all know that Linksys can't handle two PC on same server, but other brand can...
    Thank you in advance for your help.

Maybe you are looking for

  • Project Server 2010 PWA Provisioning Error - System.UnauthorizedAccessException: Access is denied.

    Hi, When migrating from a Prod Environment to a Test Environment using the Project Server 2010 5 Database backup and restore process (actually 6 DB's with the Project Sites DB), upon encountering a failure during provisioning the PWA Instance, we get

  • Date display in report

    Dear all, In SAP we have date in the dd.mm.yyyy format in the data whereas the Bi report displays date in the mm.dd.yyyy format. - how can this be corrected to display the date in dd.mm.yyyy format in BI. Regards, M.M

  • Text box-different font sizes in one box

    Sorry. I am new to final cut. I am trying to put text but want the citation underneath to be much smaller. How do I do this?

  • Greater than operator in SQL

    Hi friends, A table has 2 colums A and B.How i can return a flag ,say 1 if A is greater than B or 0 if A is less than B,by using SQL. Can any one help me out. thanks and regards, Ajith

  • Re: Portege R700-184 - Built in microphone not working

    I can't seem to get the built in microphone to work. However, it works fine with an external usb microphone. Have tried changing the settings in the control panel called 'Sound' where I click on the 'Recording Tab'. 'Microphone' shows a green tick as