public void bind()

in core/src/main/java/org/apache/mina/transport/bio/BioUdpServer.java [94:134]


    public void bind(SocketAddress localAddress) {
        LOG.info("binding to address {}", localAddress);
        if (bound) {
            throw new IllegalStateException("already bound");
        }
        boundAddress = localAddress;
        try {
            channel = DatagramChannel.open();
            channel.socket().bind(localAddress);
            Boolean reuseAddress = config.isReuseAddress();

            if (reuseAddress != null) {
                channel.socket().setReuseAddress(reuseAddress);
            }

            Integer readBufferSize = config.getReadBufferSize();

            if (readBufferSize != null) {
                channel.socket().setReceiveBufferSize(readBufferSize);
            }

            Integer sendBufferSize = config.getSendBufferSize();

            if (sendBufferSize != null) {
                channel.socket().setSendBufferSize(sendBufferSize);
            }

            Integer trafficClass = config.getTrafficClass();

            if (trafficClass != null) {
                channel.socket().setTrafficClass(trafficClass);
            }
        } catch (IOException e) {
            throw new MinaRuntimeException("Can't open and configure a new udp socket", e);
        }

        worker = new Worker();
        bound = true;
        worker.start();
        idleChecker.start();
    }