문제

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?

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top