Question

I've read the discussion, and now I am working on my own simple Android firewall. Here is the algorithm they used.

The discussion

I was able to forward packets. If I remember correctly I just needed to read the TCP header and open another socket to that destination and send it headerless.

So now I need to write data to my Wi-Fi or 3G network interface if I understand them correctly. How to do that?

Was it helpful?

Solution

I solved it. I only needed to protect the socket which I'd like to use to send data directly to the server without using the TUN device.

Socket socket = socket = SocketChannel.open().socket();
if (!protect(socket)) {
    Log.e(Constants.TAG, "Failed to protect the socket");
}

The documentation

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top