How's the Java data transfer through Socket and ServerSocket?



  • When I hand over a specific white

    OutputStream socketOut = socket.getOutputStream();
    socketOut.write(0);
    

    He's on his way. As far as I'm concerned, the Byte will eventually be packed in the IP packet. And I don't like having a separate bag for every shipment. Can't they be put in one? I think I have a wrong understanding. Explain how it really works.



  • I don't think you understand what Soketa is. In your example of the code, you don't give a single bite/bit, but a whole string that contain a large number of whites.

    Further, the sketches are divided into two main types, TCP and UDP, and each has its own characteristics:

    TCP:

    • Uses the principle of compounds
    • Guarantees delivery and priority
    • Automatically disaggregating information on packages
    • Make sure you don't send the data too intensive. (data flow control)
    • It's easy to use - as a record/read from a file.

    UDP:

    • You don't use the principle of compounds, you're gonna have to use it manually.
    • They don't guarantee the delivery and delivery of packages. They can. Incorrectly, with duplicates, or not at all!
    • We need to manually disaggregate the data on the packages and send them.
    • We need to make sure we don't send the data too intensive.
    • If the bag's lost, we need to track it somehow, and in case. need to send him over.

    In your case, TCP is used. In other words, you don't have to worry about correct data delivery.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2