44166

Will TCP connection lose packets?

Question:

Say Server S have a successful TCP connection with Client C.

C is keep sending 256-byte-long packets to S.

Is it possible that one of packets only receive part of it, but the connection does not break (Can continue receive new packets correctly)?

I thought TCP protocol itself will guarantee not lose any bytes while connecting. But seems not?

P.S. I'm using Python's <a href="https://docs.python.org/3.4/library/socketserver.html" rel="nofollow">socketserver</a> library.

Answer1:

The TCP protocol does guarantee delivery. Thus (assuming there are no bugs in your code and in the TCP stack), the scenario you describe is impossible.

Do bear in mind that TCP is stream- rather than packet-oriented. This means that you may need to call recv() multiple times to read the entire 256-byte packet.

Recommend

  • How can I do a 301 redirect from http to https in Wildfly 8.2?
  • Putting incomplete nested lists in a rectangular ndarray
  • shutdown and update job in Google Dataflow with PubSubIO + message guarantees
  • PHP problems with current url
  • How can I get a specific version of a dataset row?
  • detecting connection lost in spark streaming
  • New-PSSession in an Azure-runbook (ARM)
  • PHP: Get HTTP Protocol Version (HTTP/1.1 vs HTTP/2)
  • UIImagePickerControllerDelegate Methods Not Called When Delegate Not UIViewController
  • qt how to know that a pushbutton is clicked?
  • FragmentActivity with a Fragment Containing a MapView
  • What I have to do to guarantee that ccc.jar is loaded before aaa.jar?
  • Base64 as method of sanitizing user input for Mysql
  • Always require certain dependencies in RequireJS
  • How to populate html table with info from list in django
  • Prevent page break in text block with iText, XMLWorker
  • Python pandas melting data to multiple columns and coulmn names in another column
  • Shouldn't else be indented in the below code
  • import scipy.sparse failed
  • How can I tell a form not to dispose a particular control when it closes?
  • Hash Code in SQL Server?
  • Can I read an iPhone beacon with Windows.Devices.Bluetooth.Advertisement.BluetoothLEManufacturerData
  • During installation of Django, why do I keep getting ImportError: No module named django?
  • where do I find the xml.dom python package for the python-2.6.0-8.9.28 and I have a suse/x86_64 vers
  • Python pickle not one-to-one: different pickles give same object
  • Intel-64 and ia32 atomic operations acquire-release semantics and GCC 5+
  • Multicolored edittext hint
  • Read text file that is not in the main package in a runnable jar
  • Redux Form - Not able to type anything in input
  • Does Mobilefirst provide a provision to access web services directly?
  • WPF - CanExecute dosn't fire when raising Commands from a UserControl
  • How can I sort a a table with VBA with given text condition?
  • copying resource to sdcard gives a damaged file in android
  • Spark fat jar to run multiple versions on YARN
  • why do I get the error when installing the gem 'pg'? [duplicate]
  • FileReader+canvas image loading problem
  • All Classes Conforming to Protocol Inherit Default Implementation
  • Why value captured by reference in lambda is broken? [duplicate]
  • Change div Background jquery
  • Is it possible to post an object from jquery to bottle.py?