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

Similar Messages

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

  • Listener's have same port number

    Friends,
    I have two listener's configured in listener.ora file with same port number .Is it any problem if i gave the same port number?Please advise me.

    Yes, it is a problem if host is the same for both.
    If You have two listeners with same port number and on same machine You will not be able to start them both, because port number will be already in use. One will start, the second one will through an error.
    Change port number for one of them.

  • 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

  • Can I listens to the same port in differernt threads on the same computer

    Q1:can I listens to the same port in differernt threads on the same computer?
    Q2:if I use two thread to listen to two different port, you know, as the method for listening is a block method, will them block each other?
    Thank you very much!

    Q1:can I listens to the same port in differernt
    threads on the same computer?If you mean ServerSocket.accept(), the answer is yes.
    Q2:if I use two thread to listen to two different
    port, you know, as the method for listening is a
    block method, will them block each other?No.

  • Multiple instances of WL on the same box :several Ip addresses using the same port

    Hi all,
    I want to set up several instances of WL on the same server. These
    instances will be clustered.
    I am using Apache for the WebServer.
    Here the configuration I used:
    I first change the weblogic.conf file in Apache to set up the bridge.I
    restart apache using apachectl.
    Then, on the WebLogic site, I created a new ipadress using ifconfig
    hme0:1 ip adress ...
    I created a file hostname.hme0:1 in /etc
    I added this Ip address in /etc/hosts.
    I added this Ip address in the mycluster DNS.
    I wanted to start both WL manually using startWebLogic.sh file to see
    the log file.
    So, I first assign hostname to WL1. Then start WL.
    I opened an other terminal. Assign the hostname to WL2. Then start using
    startWebLogic.sh.
    The first instance started correctly.When the second started, there was
    an error: when listening to the port 7001, this port was already used.
    That was the same with the port 7002.
    Then , my question is How is it possible to configure several instances
    on the same machine using several ip addresses and one port.
    Thank you for your help.
    Erwan

              Please try -Dweblogic.system.bindAddr=<a.b.c.d> in your startWebLogic.sh.
              Brian
              "Merg" <[email protected]> wrote:
              >> Then , my question is How is it possible to configure
              >> several instances on the same machine using several
              >ip
              >> addresses and one port. Thank you for your help. Eourwan
              >
              >On Win2K/WinNT you can assign several IP adresses to you
              >NIC. (Advanced
              >TCP/IP options.) Each server instance has to run on it's
              >own port.
              >
              >Regards,
              >Merg
              >
              >
              

  • Does the server listen in the same port or on a random one....?

    Hi all,
    As I went through the Java Tutorial in Sun's website I found that though the server is assigned a port to listen, it does the actual communication with the client in another port and keeps the assigned port listening for other clients.
    Can't we control this..?

    The real number can even go upto 5000.Even 5000 is not alot. Whether you use NIO or blocking IO is going to make more of a differnece.
    And we consider this because of some firewall restrictions (from my real client).That depends on how their firewalls are set. Unless they block HTTP and most other internet protocols (which I doubt) Then they only restrict the port the connection is opened on, not the port a open connection sends a packet to.

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

  • How to configure multiple listeners to listen for the same instance.

    Hello everyone,
    I am running oracle database 11g and I want information regarding how to configure multiple listeners to listen for the same database instance. Actually I know how to configure more than one listener but the main thing that I am confused about is when we create listener.ora file, do we have to statically register the database instance with both the listeners or the instance will register itself with both the listeners.
    According to my knowledge the instance will register with the listener specified by LOCAL_LISTENER parameter and we cannot have more than one value for this parameter.
    Please only give detailed answers with example as I am tired of simple answers with details that I already know.

    Hello,
    Yes, it can make sense to have several listener for one Oracle instance. For instance you may have one listener for the applications another listener for DBA administration tasks as well as one listener dedicated to dataguard broker. It is not possible to have several listeners listening on the same IP and Port.
    By default the database try to automatically register to a listener on port 1521. To instruct the instance to register to a specifc list of listeners you can add in the init.ora the local_listener parameter with an alias definition:
    i.e
    local_listener=MY_SET_OFF_LISTENERS
    in your tnsname.ora add an entry called:
    MY_SET_OFF_LISTENERS_LOCAL= (ADDRESS_LIST=
    (ADRESS=(PROTOCOL=TCP)(HOST=myhostname)(PORT=1530))
    (ADRESS=(PROTOCOL=TCP)(HOST=myhostname)(PORT=1531))
    (ADRESS=(PROTOCOL=TCP)(HOST=myhostname)(PORT=1532))
    In this sample your instance will register to three listeners listening on respectively port 1530, 1531 and 1532
    If you want your clients can be balanced over the 3 listeners

  • Creating a serverSocket while sonnecting to a socket on the same port

    I want to make a file transfer application for multiple clients, there will not be a server that users will connect to, the application serves as client AND server, every client will have a serversocket object listen for new connections (it will recieve a connection when someone wants to send a file to them) and I will also have a socket object that will connect to a client when I want to send a file to them.
    Is it possible to run all these connections on a single port? Or will there be a conflict?

    836981 wrote:
    I want to make a file transfer application for multiple clients, there will not be a server that users will connect to, the application serves as client AND server, every client will have a serversocket object listen for new connections (it will receive a connection when someone wants to send a file to them)Read up on peer-to-peer.
    and I will also have a socket object that will connect to a client when I want to send a file to them.A new socket for each outbound connection.
    Is it possible to run all these connections on a single port?Yes. A serversocket listens for connections to a specific port number, it can accept many connections.
    Or will there be a conflict?No. Your outbound connections will not use the same port number locally.
    You are more likely to encounter problems with clients (peers) behind NAT routers.

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

  • Installation on same port number

    Hello,
    Suppose we have a host with two or more alias.
    Every alias have a different IP address.
    We have a Directory Server running on 389 installed on server ( alias A ).
    When I try to install a new Directory Server over the same port on the same server ( using alias B ) the installation program says "the port is in use".
    Is it possible to install Directory Server over the same port number ( 389 ) on the same server ( alias B ) without problems ?
    Thanks,
    silvio

    Silvio,
    you can do it by:
    - installing first instance, bind it to IP address assigned
    to alias A by changing attribute nsslapd-listenhost (by
    default this attribute is empty and DS binds to all the IP
    addresses of the machine) and restarting the instance;
    - create the second instance using the same port (389
    or whatever you like) , then changing its sslapd-listenhost
    attribute to alias B and finally restarting it.
    Hope it helps ; for any other info, feel free to contact me at
    [email protected] (you probably being Italian like me ...)
    Ciao,
    Michele Montagni

  • I tried to install yosemite yesterday and my computer goes through the whole installation process and then to a blank white screen.  I've rebooted, I've reinstalled several times and get the same result.  Two days wasted!

    I tried to install yosemite yesterday and my computer goes through the whole installation process and then to a blank white screen.  I've rebooted, I've reinstalled several times and get the same result.  Two days wasted and I can't use my computer!!

    I don't know if you've already resolved your problem, but I had the same thing, it took me 6 hours to fix it. I had the exact same as you, installed the update and then it went to a white screen. After trying start up holding down cmmd r or holding down the alt key to try to install it again, nothing worked, same result every time. Then an angel came to me here somewhere but I can't find it now to thank him. Start in safe mode, press shift once you hear the start up chime and hold it down until you hear it again. Installation completion box came up and it was working. turn off computer and start up again normally and all is well. Except my final cut pro x doesn't work with it, have to update that now too. same as when I updated to mavericks.
    Hope this helps.

  • Can I use the same trip number for several travelers?

    Hi everybody.
    This is my question... We need (in travel expenses) to use any field in order to group (add) several trips made for several travelers (in same dates).
    Expl: several travelers made the same trip (with different receipts and costs). We need to create a "supra-level" group (which could help our user to summarize, authorize, etc).
    I have made some tests changing the trip number assignment (in trip schema) to external one. The system seems not to have any problem if I assign the same trip number to several travelers (please, could you tell me if this is correct?).
    I´m not sure this could be the best solution, because I have one question... If I have travel request and travel expenses... can I assign external range numbers to the travel request? (how can I do it?).
    Please, could you tell me something about this? (if this is not correct, could you tell me if it´s possible to create a new field to do this?)
    Thanks!!!!!!

    Hi,
    As mentionned in an earlier response, you cannot assign the same trip number to multiple employees.
    If you are looking to group together similar claims based on the type of travel which was done, you can always use any of the following fields which can be made 'available' on the entry screen.  That is the 'Activity Type' or the 'Trip Type Specific' or the 'Trip Type Enterprise'.  By creating categories of types of travel, you can then use these values as selection parameters in your reports to isolate specific costs related to specific activities.
    For example, you know that many employees will be traveling for a specific conference and you want to be able to report on the total cost of that conference, you could create an Activity Type and ask employees to complete the field with the appropriate value when completing the claim.  Then you could create a report on that Activity Type only.
    Another option would be to use Internal Orders.  Create an internal order, have the employees assign their costs to the IO and then run a CO - IO report.
    Depending on how 'permanent' your employee groupings are, you could also use some fields on Infotype 17 to assign different employees to different employee groupings.  These employee grouping values are also available as selection parameters in the reports and can allow you to isolate groupings of individuals. 
    It all depends where you want to create the grouping....
    Hope this helps you somewhat...
    Regards,
    Roxanne Dore
    Travel & FI Consultant

  • Ability to process several raw files with the same content but with different exposure into the single picture

    Can you add to the Lightroom an ability to process several raw files with the same content but with different exposure into the single picture?
    Base raw files can be given with exposure bracketing during shooting, for example.
    The goal - to get maximum details in darks and lights (if we use the "ligths recovery" or "fill lights" we lose the quality because raw file just have no all required information).
    The similar (but not the same, only the idea) thing - is High Dynamic Range Photography in Adobe Photoshop
    Thank you

    The plugin LR/Enfuse does this already. And of course Photomatix have a plugin available for Lightroom. This essentially amounts to pixel editing, which is beyond the range of Lightroom's metadata editing.

Maybe you are looking for

  • Cannot use Creative Cloud in new Mac after using Migration Assistant

    I used Migration Assistant to set up my new Mac (new computer is a Retina MacBookPro; so was old computer). I could not open any of my CC apps. When I open Creative Cloud Desktop App it is completely blank (no tabs for Apps, Fonts, Files, etc. -- No

  • Can a USB charging port be replaced?

    I have a Samsung charge. If I plug in the USB charger, the phone goes blank and freezes. This occurs even if the charger is not connected to power, so I suspect there is a loose connection or unseated port. If I remove the battery and replace, lettin

  • Acrobat Upgrade Issue

    I have Acrobat v 10.1.1 & am needing to upgrade my install package to 10.1.4. For some reason when I run msiexec /a acrostan.msi /p acrobatupd1014.msp I get the following error: "The upgrade patch cannot be installed by the Windows Installer service

  • How can I treat many tables with one handler(?) ?

    Hello~ I am applying BDB to my embbeded system not rich in resource. Some *.db files are called frequently. But, Opening a *.db file [db_create(&dbp, NULL, 0) AND dbp->open] takes a long time in BDB So, I loaded this functions onto a booting module t

  • Photo Lab that supports osx

    I am looking for an online photo lab to print digital images from iPhoto. So far, I have tried Walmart and Mystic. Walmart's software does not work with OSX (requires Internet Explorer) and the manual approach only allows ordering 2 to 3 prints at a