Android: Receive packets from only one ip address
<p>how to make my android tablet receive data packets from only one ip address through wifi and not to allow it to receive from other ip address.</p>

<p>here is the code</p>

<p><strong>- for scan and then registering</strong></p>

<pre><code>String connectivity_context = Context.WIFI_SERVICE;
            final WifiManager wifi = (WifiManager) getSystemService(connectivity_context);  
if (wifi.isWifiEnabled()) {
                        wifi.startScan();
                    }


IntentFilter i = new IntentFilter();
i.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);

BroadcastReceiver receiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent i) {
        // TODO Auto-generated method stub
        ScanWiFiActivity a = ScanWiFiActivity.instance();
        WifiManager w = (WifiManager) context
                .getSystemService(Context.WIFI_SERVICE);
        List&lt;ScanResult&gt; l = w.getScanResults();
        a.Clear();
        for (ScanResult r : l) {
                              //do what i want with the required result
        }
    }
};
registerReceiver(receiver, i);
</code></pre>

<p>in the for block i will do the required things.</p>
