socket.io - Android Socket Programing Exception -


i trying send data android studio using udp got exception on line server.send(packet) throwing exception .... here code mainactivity....

    public void onclickloginbutton(view view) throws ioexception     {         loginbutton = (button) findviewbyid(r.id.button);         edittext= (edittext) findviewbyid(r.id.edittext);         edittext edittext1 = (edittext) findviewbyid(r.id.edittext2);         send=new byte[1024];         receive=new byte[1024];             send="login".getbytes();             datagrampacket packet2 = new datagrampacket(send, send.length, inetaddress.getbyname("192.168.10.9"), 1205);              try {                  server.send(packet2);              }              catch(exception e)              {                   log.d(getclass().getsimplename(),"error");              }          string client = edittext.gettext().tostring();             send = client.getbytes();             datagrampacket packet = new datagrampacket(send, send.length, inetaddress.getbyname("192.168.10.9"), 1205);             server.send(packet);              string string = edittext1.gettext().tostring();             send = client.getbytes();             datagrampacket datagrampacket = new datagrampacket(send, send.length, inetaddress.getbyname("192.168.10.9"), 1235);             server.send(packet);               datagrampacket packet1 = new datagrampacket(receive, receive.length);             server.receive(packet1);          log.d(getclass().getsimplename(), "connection failed"                 );        } } 

exception:

29830/com.example.hamza.weekendmessanger e/androidruntime: fatal exception: main java.lang.illegalstateexception: not execute method android:onclick 

i think have add proper permission in

manifest

here are:

<uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.access_wifi_state" /> <uses-permission android:name="android.permission.change_wifi_state" /> <uses-permission android:name="android.permission.change_network_state" /> <uses-permission android:name="android.permission.access_network_state" /> 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -