I try to send data to server when incoming call through mobile data (4G). I get one of these errors:
java.net.UnknownHostException: Host is unresolved: xyz.xy
or
java.net.SocketTimeoutException: failed to connect to /xxx.xxx.xxx.xxx (port yyyyyy) after 15000ms
When is WIFI on, data is sending during incoming call.
Here is part of code:
Socket socket = new Socket();
DataOutputStream dos;
DataInputStream dis;
try {
socket.connect(new InetSocketAddress(SERVER_IP, SERVER_PORT), CONNECTION_TIMEOUT);
socket.setTcpNoDelay(true);
socket.setSoTimeout(READ_TIMEOUT);
dos = new DataOutputStream(socket.getOutputStream());
dis = new DataInputStream(socket.getInputStream());
int count = text.getBytes("UTF-8").length;
ByteBuffer data = ByteBuffer.allocate(count);
data.put(text.getBytes("UTF-8"));
dos.write(data.array(), 0, data.array().length);
Is a problem send data through mobile data (4G) when incomming call? Or I am missing any settings?
EDIT
I was reading, if phone support SVDO technology or 4G LTE, modem can accepting call and send data. My phone Xiaomi Redmi 3S has this technology.
I found problem. Problem is in operator and technology VoLTE. In Czech Republic can do that only with O2 operator see forum. In Samsung Galaxy S7 it's working.