Package java.net

Examples of java.net.DatagramSocket


  @Override
  public void startup() {
    try {
      dgram = new DatagramPacket(discoveryPacket, discoveryPacket.length, manager.networkMulticastAddress,
          manager.networkMulticastPort);
      socket = new DatagramSocket();
    } catch (Exception e) {
      OLogManager.instance().error(this, "Can't startup distributed server discovery signaler", e);
    }
    super.startup();
  }
View Full Code Here


    assertEquals("com.bea.sipservlet.tck.apps.spectestapp.uas", message.getHeader("application-name"));
  }

  private void send(String message) throws Exception
  {
    DatagramSocket ds = new DatagramSocket();
   
    byte[] b = message.getBytes("UTF-8");
    DatagramPacket packet = new DatagramPacket(b, 0, b.length, InetAddress.getLocalHost(), 5040);
 
    ds.send(packet);
  }
View Full Code Here

  }
 
  protected DatagramSocket newDatagramSocket() throws IOException
  {
    if (getHost() == null)
      _datagramSocket = new DatagramSocket(getPort());
    else
      _datagramSocket = new DatagramSocket(getPort(), InetAddress.getByName(getHost()));

    return _datagramSocket;
  }
View Full Code Here

    server.start();
    byte[] b = __msg.getBytes();
    DatagramPacket packet = new DatagramPacket(b, b.length);
    packet.setAddress(InetAddress.getLocalHost());
    packet.setPort(5060);
    DatagramSocket socket = new DatagramSocket();
    socket.send(packet);
  }
View Full Code Here

    }

    public void init() throws Exception
    {
        String fileName = getFileName("hello", _audioPayloadType);
        DatagramSocket datagramSocket = new DatagramSocket();
        UdpEndPoint udpEndPoint = new UdpEndPoint(datagramSocket);
        _player = new Player(fileName, _host, _destPort, _audioPayloadType,
                udpEndPoint);
        _dtmfHandler = new DtmfHandler(_dtmfPayloadType, udpEndPoint);
        _player.init();
        _dtmfHandler.init();
        _dtmfHandlerThread = new Thread(_dtmfHandler);
        _player.addEventListener(this);
        _dtmfHandler.addDtmfListener(this);
        _filenames = Collections.synchronizedList(new ArrayList<String>());
        _localPort = datagramSocket.getLocalPort();
        _timer = new Timer();
        _playingMutex = new Object();
        synchronized (_playingMutex)
        {
            _playing = false;
View Full Code Here

    return new Connection(host, port);
  }
 
  public DatagramSocket newDatagramSocket() throws SocketException
  {
    return new DatagramSocket(getPort(), getHostAddr());
  }
View Full Code Here

  }
 
  protected DatagramSocket newDatagramSocket() throws IOException
  {
    if (getHost() == null)
      _datagramSocket = new DatagramSocket(getPort());
    else
      _datagramSocket = new DatagramSocket(getPort(), InetAddress.getByName(getHost()));

    return _datagramSocket;
  }
View Full Code Here

    private static void startUdpDdaemon(final JMeterEngine engine) {
        int port = JMeterUtils.getPropDefault("jmeterengine.nongui.port", UDP_PORT_DEFAULT); // $NON-NLS-1$
        int maxPort = JMeterUtils.getPropDefault("jmeterengine.nongui.maxport", 4455); // $NON-NLS-1$
        if (port > 1000){
            final DatagramSocket socket = getSocket(port, maxPort);
            if (socket != null) {
                Thread waiter = new Thread("UDP Listener"){
                    @Override
                    public void run() {
                        waitForSignals(engine, socket);
View Full Code Here

            socket.close();
        }
    }

    private static DatagramSocket getSocket(int udpPort, int udpPortMax) {
        DatagramSocket socket = null;
        int i = udpPort;
        while (i<= udpPortMax) {
            try {
                socket = new DatagramSocket(i);
                break;
            } catch (SocketException e) {
                i++;
            }           
        }
View Full Code Here

      LogLog.error("Could not find " + host +
       ". All logging will FAIL.", e);
    }

    try {
      this.ds = new DatagramSocket();
    }
    catch (SocketException e) {
      e.printStackTrace();
      LogLog.error("Could not instantiate DatagramSocket to " + host +
       ". All logging will FAIL.", e);
View Full Code Here

TOP

Related Classes of java.net.DatagramSocket

Copyright © 2018 www.massapicom. 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.