Java TCP socket: data transfer is slow

后端 未结 12 1967
误落风尘
误落风尘 2020-12-01 09:50

I set up a server with a ServerSocket, connect to it with a client machine. They\'re directly networked through a switch and the ping time is <1ms.

Now, I try to

12条回答
  •  难免孤独
    2020-12-01 10:12

    Can you try doing this over loopback, it should then transfer the data in second.

    If it takes minutes, there is something wrong with your application. If is only slow sending data over the internet it could be you network link which is slow.

    My guess is that you have a 10 Mb/s network between your client and your server and this is why your transfer is going slowly. If this is the case, try using a DeflatoutOutputStream and an InflatorInputStream for your connection.

提交回复
热议问题