Can't send large files over socket in Java

前端 未结 5 1637
执念已碎
执念已碎 2021-01-14 06:51

I got working server and client applications, they work perfect while sending small files, but when I try to send for example movie file that is 700mb over socket it gives m

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-14 07:04

    Just like you're using a buffer on the server side the send the data, use a buffer in your applet/client to read it. If you're transferring a large file, you will clearly run out of memory when you use readFully(). This method is only useful for cases where you know your data will be really, really small.

提交回复
热议问题