Package java.net

Examples of java.net.DatagramSocket.send()


    datagramPacket = new DatagramPacket(largePayload,
            1000,
            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


        DatagramSocket datagramSocket = getDatagramSocket();

        try {

            datagramSocket.send(datagramPacket);

        } catch (IOException ex) {

            throw new RuntimeException(ex);
View Full Code Here

        for(int i=0; i < num_iterations && lower < upper; i++) { // iterations to approximate frag_size
            try {
                buf=new byte[upper];
                // System.out.println("** upper=" + upper + " (lower=" + lower + ")");
                packet=new DatagramPacket(buf, buf.length, local_addr, 9);
                sock.send(packet);
                lower=Math.max(lower, upper);
                System.out.println("-- trying " + lower + " [OK]");
                upper=upper * 2;
                if(highest_failed > -1)
                    upper=Math.min(highest_failed, upper);
View Full Code Here

            System.out.println("-- fine tuning (starting at " + size + "):");
            sock=new DatagramSocket();
            for(; ;) {
                buf=new byte[size];
                packet=new DatagramPacket(buf, buf.length, InetAddress.getLocalHost(), 9);
                sock.send(packet);
                // System.out.print(size + " ");
                // System.out.println(size + " [OK]");
                frag_size=size;
                size++;
            }
View Full Code Here

                    send_msg=new Message(null, null, buf, 0, buf.length);
                    channel.send(send_msg);
                }
                else {
                    packet=new DatagramPacket(buf, buf.length, group_addr, group_port);
                    sock.send(packet);
                }
                num_sent++;
                if(num_sent % 1000 == 0)
                    System.out.println("-- sent " + num_sent);
View Full Code Here

            for(int i=0; i < num_iterations && lower < upper; i++) { // iterations to approximate frag_size
                try {
                    buf=new byte[upper];
                    // System.out.println("** upper=" + upper + " (lower=" + lower + ")");
                    packet=new DatagramPacket(buf, buf.length, local_addr, 9);
                    sock.send(packet);
                    lower=Math.max(lower, upper);
                    upper=upper * 2;
                    if(highest_failed > -1)
                        upper=Math.min(highest_failed, upper);
                }
View Full Code Here

        byte[] sendData = definition.getMessage();
        DatagramPacket sendPacket = new DatagramPacket(sendData, 0, sendData.length, socketAddress);

        try {
            socket.send(sendPacket);
            return processDatagramAnswer(definition, socket);
        } finally {
            socket.close();
        }
    }
View Full Code Here

   
    assertEquals(0, agent.adaptorCount());
    String name =agent.processAddCommand("add "+ ADAPTORID + " = "+adaptor+" UDPAdaptor raw "+PORTNO+ " 0");
    assertEquals(name, ADAPTORID);
    Thread.sleep(500);
    send.send(p);
   
    for(int i=0; i< 5; ++i) {
      Chunk c = chunks.waitForAChunk(5000);
      System.out.println("received " + i);
      assertNotNull(c);
View Full Code Here

    Thread.sleep(500);
   
    buf = "different data".getBytes();
    p = new DatagramPacket(buf, buf.length);  
    p.setSocketAddress(new InetSocketAddress("127.0.0.1",PORTNO));
    send.send(p);
    c = chunks.waitForAChunk(5000);
    assertNotNull(c);
    assertEquals(buf.length + STR.length(), c.getSeqID());
   
    agent.stopAdaptor(name, true);
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.