I am working on a Program that is going to connect to a lite coin miner via socket. The port is 4028 the ip is 192.168.0.41, but I cant even make a socket so I have written a very simple test program to try to better trouble shoot this.
package atherlrix2.cgminermonitor;
import java.net.Socket;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView hash = new TextView(this);
hash.setTextSize(175);
hash.setText("null");
try {
int port = 4028;
Socket socket = new Socket("192.168.0.41", port);
hash.setText("hhhhh");
}
catch (Exception e){}
}
}
So almost this exact code works on java. I do not under stand why it wouldn't work here. I have added these lines to my XML to try to give it permissions or something.
<uses-permission android:name="android.permission.INTERNET" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" >
</uses-permission>
I have even turned of my mobile data and made sure I am connected to WiFi.