Android Drawable, receiving image from a socket -
i'm receiving image through socket in android aplication, did debugging , when i'm going save image in drawable d, program waits happens. think has have relation clientsocket.getinputstream(); or socket. have multithreading server in c++ , when stop server, android aplication continues , can see image sent before. but, think it's not server problem, because socket in server send data , shows message printf("bytes enviados %d\n", bytesenviados); @ end of server code.
here have code:
public drawable mandamensajevideo(string mensaje, string ip, int puerto ) throws ioexception{ socket clientsocket = new socket(ip, puerto); dataoutputstream outtoserver = new dataoutputstream(clientsocket.getoutputstream()); outtoserver.writebytes(mensaje); outtoserver.flush(); inputstream inputstream = clientsocket.getinputstream(); drawable d = drawable.createfromstream(inputstream, null); clientsocket.close(); outtoserver.close(); return d; } thanks!
sounds end of inputstream never reached, never close communication.
Comments
Post a Comment