src/main/java/org/tinyradius/util/RadiusClient.java
public RadiusPacket communicate(RadiusPacket request, int port)
        throws IOException, RadiusException {
        DatagramPacket packetIn = new DatagramPacket(new byte[RadiusPacket.MAX_PACKET_LENGTH], RadiusPacket.MAX_PACKET_LENGTH);
        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()) {
                        if (ioex instanceof SocketTimeoutException) {
                            logger.error("communication failure (timeout), no more retries");
                        }
                        else {
                            logger.error("communication failure, no more retries", ioex);
                        }
                    }
                    throw ioex;
                }
                if (logger.isInfoEnabled()) {
                    logger.info("communication failure, retry " + i);
                }
                // TODO increase Acct-Delay-Time by getSocketTimeout()/1000
                // this changes the packet authenticator and requires packetOut to be
                // calculated again (call makeDatagramPacket)
            }
        }

        return null;
    }
/**
     * Sends a Radius packet to the server and awaits an answer.
     *
     * @param request packet to be sent
     * @param port    server port number
     * @return response Radius packet
     * @throws RadiusException malformed packet
     * @throws IOException     communication error (after getRetryCount()
     *                         retries)
     */
Sends a Radius packet to the server and awaits an answer.


Sends a Radius packet to the server and awaits an answer .
public RadiusPacket communicate(RadiusPacket request, int port)
        throws IOException, RadiusException {
        DatagramPacket packetIn = new DatagramPacket(new byte[RadiusPacket.MAX_PACKET_LENGTH], RadiusPacket.MAX_PACKET_LENGTH);
        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()) {
                        if (ioex instanceof SocketTimeoutException) {
                            logger.error("communication failure (timeout), no more retries");
                        }
                        else {
                            logger.error("communication failure, no more retries", ioex);
                        }
                    }
                    throw ioex;
                }
                if (logger.isInfoEnabled()) {
                    logger.info("communication failure, retry " + i);
                }
            }
        }
        return null;
    }
public RadiusPacket communicate ( RadiusPacket request , int port ) throws IOException , RadiusException { DatagramPacket packetIn = new DatagramPacket ( new byte [ RadiusPacket . MAX_PACKET_LENGTH ] , RadiusPacket . MAX_PACKET_LENGTH ) ; 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 ( ) ) { if ( ioex instanceof SocketTimeoutException ) { logger . error ( "communication failure (timeout), no more retries" ) ; } else { logger . error ( "communication failure, no more retries" , ioex ) ; } } throw ioex ; } if ( logger . isInfoEnabled ( ) ) { logger . info ( "communication failure, retry " + i ) ; } } } return null ; }
Sends a Radius packet to the server and awaits an answer.
Sends a Radius packet to the server and awaits an answer .
// TODO increase Acct-Delay-Time by getSocketTimeout()/1000
 // this changes the packet authenticator and requires packetOut to be
 // calculated again (call makeDatagramPacket)
