Bumped for version compat + added examples
    
    
      
        Getty Ritter
        7 years ago
      
    
    
  
  
  
  
    
  
    
      
      
      
        
          | 47 | 47 | 
                  import Network.UCSPI (ucspiServer)
                  
                 | 
              
| 48 | 48 | 
                  
                  
                 | 
              
| 49 | 49 | 
                  main :: IO ()
                  
                 | 
              
| 50 |  | 
                  main = ucspiServer $ \ _ -> getLine >>= putstrLn
                  
                 | 
              
 | 50 | 
                
                  main = ucspiServer $ \ _ -> getLine >>= putStrLn
                  
                 | 
              
| 51 | 51 | 
                  ~~~~
                  
                 | 
              
| 52 | 52 | 
                  
                  
                 | 
              
| 53 | 53 | 
                  To test this with a TCP connection, use
                  
                 | 
              
            
          
        
      
       
  
    
      
      
      
        
           | 1 | 
                
                  module Main where
                  
                 | 
              
 | 2 | 
                
                  
                  
                 | 
              
 | 3 | 
                
                  import Network.UCSPI as UCSPI
                  
                 | 
              
 | 4 | 
                
                  
                  
                 | 
              
 | 5 | 
                
                  main :: IO ()
                  
                 | 
              
 | 6 | 
                
                  main = UCSPI.ucspiServer $ \ _ -> getLine >>= putStrLn
                  
                 | 
              
            
          
        
      
       
  
    
      
      
      
        
           | 1 | 
                
                  name:                ucspi-examples
                  
                 | 
              
 | 2 | 
                
                  version:             0.1.0.0
                  
                 | 
              
 | 3 | 
                
                  synopsis:            Haskell helpers for UCSPI applications
                  
                 | 
              
 | 4 | 
                
                  description:         The @ucspi-hs@ package contains a few small helper functions for
                  
                 | 
              
 | 5 | 
                
                                       writing clients and servers that are intended for use with the
                  
                 | 
              
 | 6 | 
                
                                       <http://cr.yp.to/proto/ucspi.txt UCSPI interface>. This is a
                  
                 | 
              
 | 7 | 
                
                                       Unix-oriented interface in which an external application manages
                  
                 | 
              
 | 8 | 
                
                                       network connections and passes them off to another program which
                  
                 | 
              
 | 9 | 
                
                                       is given the relevant sockets as typical Unix file descriptors.
                  
                 | 
              
 | 10 | 
                
                                       This is a convenient way of building small servers without the
                  
                 | 
              
 | 11 | 
                
                                       boilerplate of socket management, and allows a given application
                  
                 | 
              
 | 12 | 
                
                                       to be trivially reused with different underlying network
                  
                 | 
              
 | 13 | 
                
                                       interfaces.
                  
                 | 
              
 | 14 | 
                
                  license:             BSD3
                  
                 | 
              
 | 15 | 
                
                  license-file:        LICENSE
                  
                 | 
              
 | 16 | 
                
                  author:              Getty Ritter
                  
                 | 
              
 | 17 | 
                
                  maintainer:          gettylefou@gmail.com
                  
                 | 
              
 | 18 | 
                
                  copyright:           © 2015 Getty Ritter
                  
                 | 
              
 | 19 | 
                
                  category:            Network
                  
                 | 
              
 | 20 | 
                
                  build-type:          Simple
                  
                 | 
              
 | 21 | 
                
                  cabal-version:       >=1.10
                  
                 | 
              
 | 22 | 
                
                  
                  
                 | 
              
 | 23 | 
                
                  executable echo
                  
                 | 
              
 | 24 | 
                
                    hs-source-dirs: echo
                  
                 | 
              
 | 25 | 
                
                    main-is: Main.hs
                  
                 | 
              
 | 26 | 
                
                    build-depends: base, ucspi-hs⏎
                  
                 | 
              
            
          
        
      
       
  
    
      
      
      
        
          | 22 | 22 | 
                  
                  
                 | 
              
| 23 | 23 | 
                  library
                  
                 | 
              
| 24 | 24 | 
                    exposed-modules:     Network.UCSPI
                  
                 | 
              
| 25 |  | 
                    build-depends:       base >=4.7 && <4.8, unix >=2.7 && <2.8
                  
                 | 
              
 | 25 | 
                
                    build-depends:       base >=4.7 && <5, unix >=2.7 && <2.8
                  
                 | 
              
| 26 | 26 | 
                    default-language:    Haskell2010
                  
                 |