title: Vertx Instantiating Multiple Vertical Instances listening to Same Socket
body: <p>I am  developing datagram server which listens to messages on a particular port and we are using Vertx Java Framework for implementing the same . Everything works fine if I specify only one instance in the Deployment Options while starting the vertical. As soon as I specify more than one instance I am getting  socket bind error. I  understand on a machine once a socket is opened and if we try to listen again on same socket it results in this error. But to take advantage of multi core processors I need to share the Datagram Socket between multiple instances of the same vertical. I am not sure how to achieve this using vertx framework . Below I have mentioned the Code snippet where I am trying to achieve the same. Please let me know where I am going wrong. </p>
  
  <pre><code>public class TestServer  extends AbstractVerticle {
  
  @Override
  public void start(Future&lt;Void&gt; startFuture) throws Exception {
  
  
      DatagramSocket accessSocket = vertx.createDatagramSocket(new DatagramSocketOptions());
      int accessPort=1234;
  
      accessSocket.listen(accessPort, "0.0.0.0", asyncResult -&gt; {
        if (asyncResult.succeeded()) {
            accessSocket.handler(packet -&gt; {
                  logger.error("Received on  Port  "+packet);
                  InetSocketAddress localAddress =  new InetSocketAddress(accessSocket.localAddress().host(), accessSocket.localAddress().port());
                  InetSocketAddress remoteAddress = new InetSocketAddress(packet.sender().host(), packet.sender().port());
                  Buffer data = packet.data();
                  try {
  
                      //handlePacket(localAddress, remoteAddress, decodePacket);
  
                  } catch (Exception e) {
                       System.out.println("listen Error while processing the packet " +packet,  e);
                  }
          });
        } else {
          System.out.println(" listen startAccessServer Failed " + asyncResult.cause());
        }
      });
  }
  
  /*
  @Override
    public void start(Future&lt;Void&gt; fut) {
      vertx
          .createHttpServer()
          .requestHandler(r -&gt; {
            r.response().end("&lt;h1&gt;Hello from Vertx " +
                "&lt;/h1&gt;");
          })
          .listen(8080, result -&gt; {
            if (result.succeeded()) {
              fut.complete();
            } else {
              fut.fail(result.cause());
            }
          });
    }
    */
  
  
   public static void main(String[] args) {
  
      DeploymentOptions options = new DeploymentOptions();
      //options.setInstances(1);
      options.setInstances(Runtime.getRuntime().availableProcessors());
      Vertx.vertx().deployVerticleObservable(TestServer.class.getName(),options).subscribe();
      System.out.println("Server Started ");
   }
  }
  </code></pre>
  
  <p>As soon as I run this code, this results in Socket bind exception except for the first vertical instance. If I specify options.setInstances(1) the problem gets solved but only one vertical instance gets started . I know I might be able to solve the problem using eventbus, but I don't want to head in that direction at this moment until or unless there is no other Options left out for me. </p>
  
  <p>What is most interesting part here is if I comment out the first start method where I am implementing the datagram socket and uncomment the second start method where I am starting httpserver on port 8080 with the same deployment options I don't see this socket bind exception happening at all. </p>
  
  <p>I belive I am missing something here in my datagram socket implementation which is resulting in this issue. Please let me know the proper way to address this issue using vertx framework. </p>