java - Preventing split packets over TCP -


i writing program transfers files on network using tcp sockets.

now noticed when send packet in size example 1024 bytes, them split on other side.

by "split" mean packets if part of whole packet.

i tried reduce packet size , algorithm worked, when packet size immensely small (about 30 bytes per packet) file transferred slowly.

is there can in order prevent splitting?

solved:i switched connection on udp , since udp packet bounded worked

there not such thing in tcp.

tcp stream, write @ other end. not mean way written; tcp may break or group packets in order jobs possible. can send 8 mega bytes packet in 1 write , tcp can break down 10, 100 or 1000 packets, need know @ other end 8 mega bytes no more no less.

in order file transfer need tell receiver how many bytes going send. receiver may read in 1 chunk or in 100 chunks must keep track of data reads , how many bytes read.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -