Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSockets Issues #318

Open
aliang5820 opened this issue Feb 11, 2015 · 0 comments
Open

WebSockets Issues #318

aliang5820 opened this issue Feb 11, 2015 · 0 comments

Comments

@aliang5820
Copy link

When i used blow code on server
for(//about 50 counts){
socket.send(tempByte);//tempByte is a object's byte array that implement Serializable
}
But my server will call GC not stop, when my client received all data.why?
And I can't use socket.send(byte[] data) again for my client.

for example:
D/dalvikvm﹕ GC_FOR_ALLOC freed 7425K, 41% free 8777K/14848K, paused 14ms, total 14ms
D/dalvikvm﹕ GC_FOR_ALLOC freed 7425K, 41% free 8777K/14848K, paused 14ms, total 14ms
D/dalvikvm﹕ GC_FOR_ALLOC freed 7425K, 41% free 8777K/14848K, paused 14ms, total 14ms

client:
webSocket.setDataCallback(new DataCallback() {
@OverRide
public void onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
ByteBuffer[] byteBufferArray = bb.getAllArray();
LogUtil.e(TAG, "Server receive: ByteBufferList size:" + byteBufferArray.length);
ArrayList list = new ArrayList();
for (ByteBuffer byteBuffer : byteBufferArray) {
byte[] bytes = byteBuffer.array();
AppInfo appInfo = AppInfo.ByteToObject(bytes);
//save file
//Utils.getFile(appInfo.getAppIcon(), "/mnt/sdcard/" + appInfo.getPackageName() + ".png");
list.add(appInfo);
}
bb.recycle();
semaphore.release();
}
});

server:
ArrayList<byte[]> list = (ArrayList<byte[]>) bytes;
for (byte[] tempByte : list) {
socket.send(tempByte);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant