how to disable Ip address and then not accessing internet
<p>how to disable Ip address and then not accessing internet using java code?
i try this code but it does not work..........</p>

<pre><code>  private void jButtonGetIpActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        try {
            InetAddress localaddr= InetAddress.getLocalHost();
            jTextFieldIp.setText(localaddr.getHostAddress());
           } catch (UnknownHostException e) {
            jTextFieldIp.setText("Can't detect localhost : " + e);
        }

    }

private void jButtonBlockIpActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        int startPortRange=0;
        int stopPortRange=39213;

        for(int i=startPortRange; i &lt;=stopPortRange; i++) {
            try {

                Socket ServerSok = new Socket(jTextFieldIp.getText(),i);

                jTextFieldPort.setText(String.valueOf(i) );

                ServerSok.close();
            } catch (Exception e) {
            }
            jTextFieldPort.setText("Port not in use: " + i );
        }
</code></pre>
