Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,394
    • Issues 4,394
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 373
    • Merge Requests 373
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #8529

Closed
Open
Opened Nov 13, 2013 by Heimdell@trac-Heimdell

Sequent reading from socket/connection on Windows fails

I wrote a simple TCP-client, which consumes and produces 8-byte packets.

When I run it on linux, it works perfectly, being part of the loop (write-read-write-read-...).

On windows it receives only first msg from the other side (write-read-write-write-...). The packets are still going, although.

Before that, I used the sockets directly; changing to HandleStream didn't help.

The code is:

transmit :: Int -> HandleStream ByteString -> ByteString -> IO [Bytestring]
transmit delay sock packet = do
    let input = timeout delay $ sock `readBlock` 8 <* putStrLn "\nData was read!"

    sock `writeBlock` pack

    strings <- whileJust input

    return [str | Right str <- strings]

whileJust action = do
    result <- action

    case result of 
        Just a  -> (:) <$> return a <*> whileJust action
        Nothing -> return []
Trac metadata
Trac field Value
Version 7.4.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/haskell2010
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#8529