Questions tagged [network-conduit]

12 questions
8
votes
4 answers

conduit and sockets: allow multiple connections

Here's some code that implements a small receiving server using conduit, network-conduit, and stm-conduit. It receives data on a socket and then streams it through an STM-channel to the main thread. import Control.Concurrent (forkIO) import…
Impredicative
  • 5,039
  • 1
  • 17
  • 43
4
votes
1 answer

Non trivial protocol using Haskell conduit

I am trying to figure out how to implement a non-trivial protocol (over TCP) using Haskell conduit. Examples of what I consider non-trivial: Read some header byte(s) and if they match what is expected, ignore them and continue; else, return an…
Tom Kludy
  • 429
  • 3
  • 11
3
votes
1 answer

Haskell server does not reply to client

I tried building a simple client-server program following this tutorial about Haskell's network-conduit library. This is the client, which concurrently sends a file to the server and receives the answer: {-# LANGUAGE OverloadedStrings #-} import…
3
votes
1 answer

Is there a way to have a conduit take data from multiple sources without blocking any of them?

I'm writing a server and one of the requirements is that it needs to be able to push data to clients without having the data directly requested by the client. I'm using conduits but it feels like this is beyond the capabilities of conduits. The…
user467526
  • 517
  • 5
  • 19
1
vote
0 answers

Serialize Sources with conduit

I'm looking for a function that could have this signature : serializeSources :: Monad m => [Source m a] -> Source m a Having x sources with the same value produced that are serialized into 1 stream...First produced first received by downstream…
Nicolas Henin
  • 3,244
  • 2
  • 21
  • 42
1
vote
2 answers

Chunk data with Conduit

Here is an example of a conduit combinator that supposed to yield downstream when a complete message is received from upstream: import qualified Data.ByteString as BS import Data.Conduit import Data.Conduit.Combinators import…
Kuznero
  • 141
  • 6
1
vote
2 answers

Haskell simpleHTTP of Network.HTTP.Conduit performing slowly for get requests

In my haskell code I've imported Network.HTTP.Conduit as import Network.HTTP.Conduit In my main function I make a simple GET request using simpleHTTP main = do response <- simpleHttp "https://github.com/trending?l=ruby" return () It took…
user2512324
  • 791
  • 1
  • 6
  • 21
1
vote
1 answer

Getting a result from a streaming network protocol with conduit

I am implementing a simple network protocol with conduit; the protocol is a stream of messages, with each message prefixed with a uint32 describing the length of the message. (The message data then has further internal structure, but this isn't…
mithrandi
  • 1,630
  • 9
  • 27
1
vote
1 answer

How can I get a value after running a conduit?

I need to do a little back and forth between with client and get either the Client object or their name string before starting up more pipelines. But I can't seem to get appSink to let me have a return value. How should I do this? checkAddClient ::…
Joe Hillenbrand
  • 845
  • 9
  • 26
1
vote
1 answer

Missing data constructor HostAny in Haskell

I am experimenting with Conduit Network and I cannot compile this code because it is cannot find the data constructor: HostAny conduit-extra is installed so I am very puzzled why it cannot find it? {-# LANGUAGE ScopedTypeVariables #-} import…
jap
  • 617
  • 3
  • 13
0
votes
1 answer

How do I shut down `runTCPServer`?

I'm writing a socket server with runTCPServer from conduit-extra (formerly known as network-conduit). My goal is to interact with my editor using this server --- activate the server from the editor (most likely just by calling external command), use…
Yosh
  • 2,512
  • 3
  • 24
  • 30
0
votes
1 answer

Why does await always return Nothing when using network conduits?

I'm trying to learn how to use conduits. I have a conduit that takes bytestrings and groups them into packets that represent actions being sent to a server. I then have a conduit that takes these packets, acts on them and yields a response packet.…
user467526
  • 517
  • 5
  • 19