Details on the use of Java object streams note

Source: Internet
Author: User


Details on the use of Java object streams note

Recent programming uses some things to stream objects, so put the use experience and the lessons in it to the public

1. Blocking problems when object stream is created

When using TCP communication, object flow is relatively convenient, but it is worth noting that the object stream is created in a certain order, otherwise it will always block.

There are two things that must be one by one to correspond.

(1) The service side first establishes the ObjectInputStream and then establishes the ObjectOutputStream

The client first establishes the ObjectOutputStream and then establishes the Objectinoutstream

(2) The service side first establishes the ObjectOutputStream and then establishes the Objectinoutstream

The client first establishes the ObjectInputStream and then establishes the ObjectOutputStream

2. The object stream input must be flush or the other side may not receive

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.