Package java.net

Examples of java.net.MulticastSocket.receive()


        {
          isWaiting = true;
          tp.dpIn.setLength(TPacket.MAX_DATAGRAM_SIZE); // reset the receive buffer length
          if (sck != null)
          {
            sck.receive(tp.dpIn);
          }
          totalConnectionArrivals++;
          isWaiting = false;
          // got it, now interpret it ...
          if (debugLevel > 1) DbgLog.log("TFactoryThread","examine " + tp.dpIn.getLength() + " bytes");
View Full Code Here


        if (debugLevel > 1) DbgLog.log("TFactoryGlobalsThread","Waiting for globals data ...");
        try
        {
          isWaiting = true;
          tp.dpIn.setLength(TTransport.UDP_BUFFER_SIZE); // reset the receive buffer length
          sck.receive(tp.dpIn);
          isWaiting = false;
          // got it, now interpret it ...
          InterpretIncomingGlobalsData(tp.dpIn.getAddress(), tp.dpIn.getData(), tp.dpIn.getLength(), false);
        }
        catch (IOException e)
View Full Code Here

        {
          isWaiting = true;
          tp.dpIn.setLength(TPacket.MAX_DATAGRAM_SIZE); // reset the receive buffer length
          if (sck != null)
          {
            sck.receive(tp.dpIn);
          }
          totalConnectionArrivals++;
          isWaiting = false;
          // got it, now interpret it ...
          if (debugLevel > 1) DbgLog.log("TFactoryThread","examine " + tp.dpIn.getLength() + " bytes");
View Full Code Here

         // Look for a reply
         // IP address + port number = 128.128.128.128:65535 => (12+3) + 1 + (5) = 21

         buf = new byte[50];
         packet = new DatagramPacket(buf, buf.length);
         s.receive(packet);
         String myServer = new String(packet.getData()).trim();
         if (trace)
            log.trace("Received answer packet: " + myServer);
         while (myServer != null && myServer.startsWith("GET_ADDRESS"))
         {
View Full Code Here

            log.trace("Received answer packet: " + myServer);
         while (myServer != null && myServer.startsWith("GET_ADDRESS"))
         {
            Arrays.fill(buf, (byte) 0);
            packet.setLength(buf.length);
            s.receive(packet);
            byte[] reply = packet.getData();
            myServer = new String(reply).trim();
            if (trace)
               log.trace("Received answer packet: " + myServer);
         }
View Full Code Here

                    s.joinGroup(InetAddress.getByName(group));

                    // Create a DatagramPacket and do a receive
                    byte buf[] = new byte[1024];
                    DatagramPacket pack = new DatagramPacket(buf, buf.length);
                    s.receive(pack);
                    System.out.println("Received data from: " + pack.getAddress().toString() +
                                       ":" + pack.getPort() + " with length: " +
                                       pack.getLength());
                    s.leaveGroup(InetAddress.getByName(group));
                    s.close();
View Full Code Here

                channel.getConfig().getReceiveBufferSizePredictor();

            byte[] buf = new byte[predictor.nextReceiveBufferSize()];
            DatagramPacket packet = new DatagramPacket(buf, buf.length);
            try {
                socket.receive(packet);
            } catch (InterruptedIOException e) {
                // Can happen on interruption.
                // Keep receiving unless the channel is closed.
                continue;
            } catch (Throwable t) {
View Full Code Here

                channel.getConfig().getReceiveBufferSizePredictor();

            byte[] buf = new byte[predictor.nextReceiveBufferSize()];
            DatagramPacket packet = new DatagramPacket(buf, buf.length);
            try {
                socket.receive(packet);
            } catch (InterruptedIOException e) {
                // Can happen on interruption.
                // Keep receiving unless the channel is closed.
                continue;
            } catch (Throwable t) {
View Full Code Here

            multicastSocket.joinGroup(upnpAddress);

            while (true) {
              byte[] buf = new byte[1024];
              DatagramPacket receivePacket = new DatagramPacket(buf, buf.length);
              multicastSocket.receive(receivePacket);

              String s = new String(receivePacket.getData());

              InetAddress address = receivePacket.getAddress();
View Full Code Here

                channel.getConfig().getReceiveBufferSizePredictor();

            byte[] buf = new byte[predictor.nextReceiveBufferSize()];
            DatagramPacket packet = new DatagramPacket(buf, buf.length);
            try {
                socket.receive(packet);
            } catch (InterruptedIOException e) {
                // Can happen on interruption.
                // Keep receiving unless the channel is closed.
                continue;
            } catch (Throwable t) {
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.