java - Android VpnService Configuration -


i trying use vpnservice android setup simple tun device on client side , on receiving side have c++ server running.

i having lot of problems vpnservice. need, need packets outbound android phone routed tun device, , in program route through datagram channel server. when send string, works fine, when send other data through datagram channel, don't see udp packets in wireshark :\

also, new java , datagram channels. here code

//to establish tunnel builder.setsession("myvpnservice")             .addaddress("192.168.56.0", 32)             .adddnsserver("8.8.8.4")             .addroute("0.0.0.0", 1);  minterface=builder.establish(); 

what above configurations doing? isn't tun device supposed have 1 ip(from experience doing on linux), ""192.168.56.0", 32". when try add route "0.0.0.0", 0 whole android phone hangs , restarts :\

while (true) {                 int length;                 // read outgoing packet input stream.                  length=in.read(packet_bytes);                 //int length = in.read(packet.array());                 if (length > 0) {                     // write outgoing packet tunnel.                     //packet.limit(length);                     //tunnel.send(packe,server);                     tunnel.send(packet,server);                     packet.put(packet_bytes,0,length);                      tunnel.write(packet);                      packet.clear();                 }                 thread.sleep(200);                 // read incoming packet tunnel.                  length = tunnel.read(packet);                 if (length > 0) {                      out.write(packet.array(), 0, length);                      packet.clear();                      // if sending, switch receiving.                 }                 thread.sleep(200);             } 

this part take interface , put on other.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -