Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private String ipAddres = "192.168." + ad_ip.getText().toString();
- //Jeżeli chcesz wywołać to połączenie na innym adresie IP to zmieniasz sobie w taki sposób:
- private void funkcjaGdzieWywolujeInnyIp{
- ipAddres = "192.168.0.1"; //to jest twoj nowy adres ip z którym chcesz sie połączyć
- new Thread1.start();
- }
- class Thread1 extends Thread implements Runnable {
- Thread threadTest;
- public void run() {
- Socket socket = null;
- try {
- InetAddress serverAddr = InetAddress.getByName(ipAddres);
- socket = new Socket(serverAddr, SERVERPORT);
- Thread2 commThread = new Thread2(socket);
- threadTest = new Thread(commThread);
- threadTest.start();
- return;
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- public void stopThread(){
- // this.stopThread();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement