Examples of Socket


Examples of org.jeromq.ZMQ.Socket

  public void activateOptions() {
        LogLog.debug("Configuring appender...");
    super.activateOptions();

    final Context context = ZMQ.context(threads);
    Socket sender;

    if (PUBSUB.equals(socketType)) {
      LogLog.debug("Setting socket type to PUB");
      sender = context.socket(ZMQ.PUB);
    }
    else if (PUSHPULL.equals(socketType))
    {
      LogLog.debug("Setting socket type to PUSH");
      sender = context.socket(ZMQ.PUSH);
    }
    else
    {
      LogLog.debug("Setting socket type to default PUB");
      sender = context.socket(ZMQ.PUB);
    }
    sender.setLinger(1);
   
    final Socket socket = sender;
   
    final String[] endpoints = endpoint.split(",");
   
    for(String ep : endpoints) {
     
      if (BINDMODE.equals(mode)) {
        LogLog.debug("Binding socket to " + ep);
        socket.bind(ep);
      }
      else if (CONNECTMODE.equals(mode))
      {
        LogLog.debug("Connecting socket to " + ep);
        socket.connect(ep);
      }
      else
      {
        LogLog.debug("Default connecting socket to " + ep);
        socket.connect(ep);
     
    }
   
    if (identity != null) {
            LogLog.debug("Setting identity to: " + identity);
      socket.setIdentity(identity.getBytes());
    }
   
    this.socket = socket;
        LogLog.debug("Finished configuring appender");
  }
View Full Code Here

Examples of org.jvnet.glassfish.comms.clb.core.sip.Socket

     * @param transport the transport protocol
     * @throws IllegalStateException in case no local socket was found
     */
    public static Socket getLocalSocket(SipTransports transport)
        throws IllegalStateException {
        Socket localAddress = null;

        InetSocketAddress localSAddr = null;

        if (logger.isLoggable(Level.FINER)) {
            logger.log(Level.FINER,
                "Get first suitable local SipBindingCtx for TCP.");
        }

        SipBindingCtx ctx = SipBindingResolver.instance().
                getActiveInternalContext(transport);
                                             

        if (ctx != null) {
            TargetTuple tt = ctx.getTargetTupleForProtocol(transport);

            if (tt != null) {
                localSAddr = tt.getSocketAddress();

                if (logger.isLoggable(Level.FINER)) {
                    logger.log(Level.FINER,
                        "Suitable local SipBindingCtx found, using: " + ctx +
                        ", resolved address: " + localSAddr);
                }
            }
        }

        if (localSAddr != null) {
            String addr = localSAddr.getAddress().getHostAddress();

            if ("0.0.0.0".equals(addr)) {
                try {
                    addr = InetAddress.getLocalHost().getHostAddress();
                } catch (UnknownHostException ex) {
                    throw new IllegalStateException("Can't resolve local address.",
                            ex);
                }
            }

            localAddress = new Socket(addr, localSAddr.getPort());

            if (logger.isLoggable(Level.FINER)) {
                logger.log(Level.FINER,
                    "Local address resolved to: " + localAddress);
            }
        } else {
            if (System.getProperty("clb.unittest.localsocket") != null) {
                return new Socket("127.0.0.1", 5060);
            }

            throw new IllegalStateException("Can't resolve local address for '" +
                transport +
                "', there exists no listener for that transport; check your sip-listener configuration!");
View Full Code Here

Examples of org.simpleframework.transport.Socket

    * @param channel this is the connected socket to be processed
    * @param trace this is the trace to associate with the socket  
    * @param engine this is the SSL engine used for secure HTTPS 
    */
   private void process(SocketChannel channel, Trace trace, SSLEngine engine) throws IOException {
      Socket socket = new SocketWrapper(channel, trace, engine);
     
      try {
         trace.trace(ACCEPT);
         server.process(socket);
      } catch(Exception cause) {
View Full Code Here

Examples of org.zeromq.ZMQ.Socket

    String url;


    @Override
    public void shutdown() {
  Socket kill_socket = ZeroMq.socket(context, ZeroMq.push);
  ZeroMq.connect(kill_socket, url);
  VirtualPort.virtual_send(kill_socket, -1, new byte[0]);

  kill_socket.close();

  LOG.info("Waiting for virtual port at url " + url + " to die");

  try {
      vthread.join();
View Full Code Here

Examples of socketio.Socket

    }
    return instance;
  }

  public boolean connect(String server, int port) {
    socket = new Socket(server, port);
    MainPanel.outLn("Connecting to " + server + ":" + port);
    if (!socket.connect()) {
      socket = null;
      MainPanel.outLn("connect failed");
      return false;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.