Package java.net

Examples of java.net.DatagramSocket.send()


    DatagramPacket packetOut = makeDatagramPacket(request, port);
   
    DatagramSocket socket = getSocket();
    for (int i = 1; i <= getRetryCount(); i++) {
      try {
        socket.send(packetOut);
        socket.receive(packetIn);
        return makeRadiusPacket(packetIn, request);
      } catch (IOException ioex) {
        if (i == getRetryCount()) {
          if (logger.isErrorEnabled()) {
View Full Code Here


         DatagramSocket socket;
         if (proxyConnection.getPort() == getAuthPort())
           socket = getAuthSocket();
        else
          socket = getAcctSocket();
         socket.send(datagram);
    }

    /**
     * Proxies the given packet to the server given in the proxy connection.
     * Stores the proxy connection object in the cache with a key that
View Full Code Here

        // restore original authenticator
        packet.setAuthenticator(auth);

    // send packet
      DatagramSocket proxySocket = getProxySocket();
        proxySocket.send(datagram);       
    }

  /**
   * Index for Proxy-State attribute.
   */
 
View Full Code Here

      }

      getLogger().debug9("sending Job Scheduler message: " + msg);

      byte[] commandBytes = msg.getBytes();
      udpSocket.send(new DatagramPacket(commandBytes, commandBytes.length, InetAddress.getByName(_host), _port));
    }
    catch (Exception e) {
      getLogger().warn("could not send message to the Job Scheduler, cause " + e.toString());
    }
    finally {
View Full Code Here

            udpSocket.connect(objInetAddress, intPortNumber);
            if (strT.indexOf("<?xml") == -1) {
              strT = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>" + strT;
            }
            byte[] btyBuffer = strT.getBytes();
            udpSocket.send(new DatagramPacket(btyBuffer, btyBuffer.length, objInetAddress, intPortNumber));
          }
          catch (Exception e) {
            e.printStackTrace();
            throw e;
          }
View Full Code Here

       InetAddress address = InetAddress.getByName("192.168.0.41");
       DatagramPacket packet = new DatagramPacket(buf, buf.length, address, 4445);
      
       socket.setSoTimeout(1000);
      
       socket.send(packet);

           // get response
       packet = new DatagramPacket(buf, buf.length);
       socket.receive(packet);
View Full Code Here

    DatagramSocket ds = new DatagramSocket();
   
    byte[] b = message.getBytes("UTF-8");
    DatagramPacket packet = new DatagramPacket(b, 0, b.length, InetAddress.getLocalHost(), 5040);
 
    ds.send(packet);
  }
 
  class TestHandler implements SipHandler
  {
   
View Full Code Here

    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);
  }
 
  static String __msg =
        "REGISTER sip:oahu:5070 SIP/2.0\r\n"
        + "Call-ID: c117fdfda2ffd6f4a859a2d504aedb25@127.0.0.1\r\n"
View Full Code Here

            InetAddress IPAddress = receivePacket.getAddress();
            int clientPort = receivePacket.getPort();
            DatagramPacket sendPacket = new DatagramPacket("tata".getBytes(), "tata".getBytes().length, IPAddress,
                    clientPort);
            serverSocket.send(sendPacket);
        }

        // does response was wrote and sent ?
        assertTrue(msgSentLatch.await(WAIT_TIME, TimeUnit.MILLISECONDS));
View Full Code Here

    datagramPacket = new DatagramPacket(bodyWithTandH.getBytes(),
      bodyWithTandH.getBytes().length,
      InetAddress.getLocalHost(), source.getSourcePort());
    for (int i = 0; i < 10 ; i++) {
      syslogSocket = new DatagramSocket();
      syslogSocket.send(datagramPacket);
      syslogSocket.close();
    }

    List<Event> channelEvents = new ArrayList<Event>();
    Transaction txn = channel.getTransaction();
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.