title: Sending large content over Network
body: <p>so I want to send huge stuff via tcp, therefore I use the Network.Socket library...</p>
  <p>First of all I have a wrapper data type (Example!):</p>
  <pre><code>data Message =
          List [Int]
      |   String String
      |   END
      deriving stock Generic
      deriving anyclass Binary
      deriving Show
      deriving Eq
  </code></pre>
  <p>so a normal work-pipeline would be:</p>
  <pre><code>--client
  let bytestring = encode $ List [1..1000000] -- Lazzy ByteString
  send socket $ toStrict bytestring
  --server
  Just msg &lt;- recv socket 1024 
  print $ decode $ fromStrict msg
  </code></pre>
  <p>the problem with this is: I get the following error:</p>
  <blockquote>
  <p>Data.Binary.Get.runGet at position 1017: not enough bytes CallStack
  (from HasCallStack):   error, called at
  libraries/binary/src/Data/Binary/Get.hs:351:5 in
  binary-0.8.8.0:Data.Binary.Get ClientProjekt: Network.Socket.sendBuf:
  resource vanished (Broken pipe)</p>
  </blockquote>
  <p>Allthough</p>
  <ul>
  <li>just sending/reciving and printing without decoding on the server works fine.</li>
  <li>encoding -&gt; toStrict -&gt; fromStrict -&gt; decoding: without sending over tcp works fine.</li>
  </ul>
  <p>so what does the network do with the bytestring which breaks the decoding functionality?</p>