What does 'end of stream' mean when working with sockets

前端 未结 4 1424
挽巷
挽巷 2021-02-01 19:52

When working with Sockets in Java, how can you tell whether the client has finished sending all (binary) data, before you could start processing them. Consider for example:

4条回答
  •  猫巷女王i
    2021-02-01 20:27

    as Nikita said this is more of task of protocol. Either you can go by header and body approach or you can send a special character or symbol for end of stream to break processing loop. Something like if you send say '[[END]]' on socket to denote end of stream.

提交回复
热议问题