Sending images continously over udp in android java -


i sending screenshots of pc screen android tab on udp. while size of image data increases transmission stops. intially images of 10 kb being sent, when image size changed 12kb, images not received, if images less size initial received size, images received in tab. reason behind this. code receive datagram packet

   private class udpreceiver implements runnable {          string path = environment                 .getexternalstoragepublicdirectory(environment.directory_dcim)                 + file.separator + "simple";         file directory = new file(path);         byte[] incommmingdata = new byte[65 * 1024];         datagrampacket p = new datagrampacket(incommmingdata,                 incommmingdata.length);         int file_size;           public void run() {             try {                 while (true) {                     datagaramsoc = new datagramsocket(1546);                     fileoutputstream outstream = null;                                     file_num = file_num + 1;                      datagaramsoc.receive(p);                   file_size = integer.parseint(new string(p.getdata())                             .substring(2).substring(0, 5));                     if (!directory.isdirectory()) {                         directory.mkdir();                     }                     imagepath = new file(path + "/" + file_num                             + "simpleimage.jpg");                     outstream = new fileoutputstream(imagepath);                 bufferedoutputstream bos = new bufferedoutputstream(                             outstream);                     bos.write(p.getdata(), file_start, file_size);                     bos.flush();                     bos.close();                     outstream.flush();                     outstream.close();                     p.setlength(incommmingdata.length);                     runthread(file_num);                     datagaramsoc.close();                 }             } catch (exception e) {                 // todo auto-generated catch block                 e.printstacktrace();             } {                 if (datagaramsoc != null)                     datagaramsoc.close();             }          };      } 

please me in solving this


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -