java - error when base64String arrived from android to nodejs via socketio -


i work on app send image android nodejs via socket io , got error when send data has size 700,00 kb in node js , don't know how can me work better ??? java code

file myfile = new file (selectedimagepath);             int ficher = (int) myfile.length();             system.out.println(""+size(ficher));             int file_size = integer.parseint(string.valueof(myfile.length()/1024));             system.out.println(""+file_size);             size(ficher);                 fileinputstream imageinfile = null;                 try {                     imageinfile = new fileinputstream(myfile);                 } catch (filenotfoundexception e) {                     // todo auto-generated catch block                     e.printstacktrace();                 }                   byte imagedata[] = new byte[(int) myfile.length()];                 try {                     imageinfile.read(imagedata);                 } catch (ioexception e) {                     // todo auto-generated catch block                     e.printstacktrace();                 }                 // convert base64;                 string imagedatastring = base64.encodetostring(imagedata, select_picture);             socket.emit("img", imagedatastring, "mak", "mak"); 

and javascript code (node js) here

socket.on('img', function(msg, usr, username){ console.log(' message : '+username+' \n message : '+msg+"\n : "+usr) console.log(usernames[usr]) console.log(usernames) io.sockets.socket(usernames[usr]).emit('event', msg, username);        fs.writefile(username+ "- -"+usr+'.png', msg, "base64", function(err){if(err){console.log(err)}}) 

});

this error got

aaal9woagfzc2v0cy9z\nzxr0aw5nc2nyzwvulnbuz1blbqyaaaaamqczamgnaacf/w4aaaa\n","243 810840505","apk","23:10"]} debug - emitting heartbeat client ig4qpjbtaegr20jos6ia assertion failed: end <= source_len, file src\smalloc.cc, line 280 c:\xampp\htdocs\socketio_android-master\socketio_android-master> 

i use socket io version 0.9.16 all!!


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -