阅读背景:

Java - 等待流完成写入?

来源:互联网 

I have a "server" running in java and I am sending files via byte array to a "client" (android system). The functionality works fine, but I've noticed when I try to send larger files (1MB+), it doesnt successfully write all the bytes before closing (Ex: tried sending 5mb, and it only sent 902 bytes). Is there a way to have the code wait for the stream to finish writing before closing the stream? Below is the code and the stack trace. Essentially the send message method is called when a file is attached and sent (in a class that handles the GUI). In this case, I wasnt trying to receive data from the client, just send data TO the client.I have a "server" running in java and I am send




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: