I took a quick look on hackage for an interface to windows networking function calls, and didn't find anything that worked. I may have overlooked something. What's the state of windows network programming? Any recommendations for a good package?
Have you tried the 'network' package on Hackage? I had thought it was cross-platform. I do not do much development on Windows. On Nov 1, 2010 6:45 PM, "Michael Litchard" <michael@schmong.org> wrote:
I took a quick look on hackage for an interface to windows networking function calls, and didn't find anything that worked. I may have overlooked something. What's the state of windows network programming? Any recommendations for a good package? _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
On Mon, Nov 1, 2010 at 7:04 PM, Antoine Latter <aslatter@gmail.com> wrote:
Have you tried the 'network' package on Hackage? I had thought it was cross-platform. I do not do much development on Windows.
On Nov 1, 2010 6:45 PM, "Michael Litchard" <michael@schmong.org> wrote:
I took a quick look on hackage for an interface to windows networking function calls, and didn't find anything that worked. I may have overlooked something. What's the state of windows network programming? Any recommendations for a good package?
Yes, I think it is cross-platform and it ships with Haskell Platform (so you don't have to compile by yourself). http://hackage.haskell.org/platform/contents.html Michael, also note that the newest version on Hackage merges "network" and "network-bytestring". http://hackage.haskell.org/package/network Paulo
Am 02.11.2010 01:20, schrieb Paulo Tanimoto:
You just have to remember that you need to call "withSocketsDo" on windows before doing anything with the network library.
got any urls with examples? On Tue, Nov 2, 2010 at 12:17 AM, Nils Schweinsberg <ml@n-sch.de> wrote:
Am 02.11.2010 01:20, schrieb Paulo Tanimoto:
You just have to remember that you need to call "withSocketsDo" on windows before doing anything with the network library. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Am 02.11.2010 19:57, schrieb Michael Litchard:
got any urls with examples?
Sure, see this short server-client-ping-pong application. By the way, I noticed that you don't need withSocketsDo on windows 7, but I guess it's there for a reason for older windows versions. :) import Control.Concurrent import Network import System.IO main :: IO () main = withSocketsDo $ do forkIO waitAndPong ping -- The basic server waitAndPong :: IO () waitAndPong = do socket <- listenOn (PortNumber 1234) (handle,_,_) <- accept socket hSetBuffering handle LineBuffering incoming <- hGetLine handle putStrLn ("> " ++ incoming) hPutStrLn handle "pong" -- The basic client ping :: IO () ping = do handle <- connectTo "localhost" (PortNumber 1234) hSetBuffering handle LineBuffering hPutStrLn handle "ping" incoming <- hGetLine handle putStrLn ("< " ++ incoming)
I tried this as an example and got the following error when running. net.exe: connect: failed (Connection refused (WSAECONNREFUSED)) Firewall is off, running as administrator Windows is Windows 7 Enterprise. Advice on what to do next is appreciated On Tue, Nov 2, 2010 at 1:24 PM, Nils Schweinsberg <ml@n-sch.de> wrote:
Am 02.11.2010 19:57, schrieb Michael Litchard:
got any urls with examples?
Sure, see this short server-client-ping-pong application.
By the way, I noticed that you don't need withSocketsDo on windows 7, but I guess it's there for a reason for older windows versions. :)
import Control.Concurrent import Network import System.IO
main :: IO () main = withSocketsDo $ do forkIO waitAndPong ping
-- The basic server waitAndPong :: IO () waitAndPong = do socket <- listenOn (PortNumber 1234) (handle,_,_) <- accept socket hSetBuffering handle LineBuffering incoming <- hGetLine handle putStrLn ("> " ++ incoming) hPutStrLn handle "pong"
-- The basic client ping :: IO () ping = do handle <- connectTo "localhost" (PortNumber 1234) hSetBuffering handle LineBuffering hPutStrLn handle "ping" incoming <- hGetLine handle putStrLn ("< " ++ incoming)
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
freenode figured this out. Pasting here for future reference. import Control.Concurrent import Network import System.IO main :: IO () main = withSocketsDo $ do m <- newEmptyMVar forkIO (waitAndPong m) ping m -- The basic server waitAndPong :: MVar () -> IO () waitAndPong m = do socket <- listenOn (PortNumber 8000) putMVar m () (handle,_,_) <- accept socket hSetBuffering handle LineBuffering incoming <- hGetLine handle putStrLn ("> " ++ incoming) hPutStrLn handle "pong" -- The basic client ping :: MVar () -> IO () ping m = do _ <- takeMVar m handle <- connectTo "localhost" (PortNumber 8000) hSetBuffering handle LineBuffering hPutStrLn handle "ping" incoming <- hGetLine handle putStrLn ("< " ++ incoming) On Thu, Jan 20, 2011 at 6:17 PM, Michael Litchard <michael@schmong.org>wrote:
I tried this as an example and got the following error when running.
net.exe: connect: failed (Connection refused (WSAECONNREFUSED))
Firewall is off, running as administrator
Windows is Windows 7 Enterprise.
Advice on what to do next is appreciated
On Tue, Nov 2, 2010 at 1:24 PM, Nils Schweinsberg <ml@n-sch.de> wrote:
Am 02.11.2010 19:57, schrieb Michael Litchard:
got any urls with examples?
Sure, see this short server-client-ping-pong application.
By the way, I noticed that you don't need withSocketsDo on windows 7, but I guess it's there for a reason for older windows versions. :)
import Control.Concurrent import Network import System.IO
main :: IO () main = withSocketsDo $ do forkIO waitAndPong ping
-- The basic server waitAndPong :: IO () waitAndPong = do socket <- listenOn (PortNumber 1234) (handle,_,_) <- accept socket hSetBuffering handle LineBuffering incoming <- hGetLine handle putStrLn ("> " ++ incoming) hPutStrLn handle "pong"
-- The basic client ping :: IO () ping = do handle <- connectTo "localhost" (PortNumber 1234) hSetBuffering handle LineBuffering hPutStrLn handle "ping" incoming <- hGetLine handle putStrLn ("< " ++ incoming)
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Just starting out here so I don't know what I'm doing yet, but this one doesn't compile for me. ping.hs:19:13: parse error on input `<-' So am I doing something stupid here or is there something wrong with the code? -Tako On Fri, Jan 21, 2011 at 04:48, Michael Litchard <michael@schmong.org> wrote:
freenode figured this out. Pasting here for future reference.
import Control.Concurrent import Network import System.IO
main :: IO () main = withSocketsDo $ do m <- newEmptyMVar
forkIO (waitAndPong m) ping m
-- The basic server waitAndPong :: MVar () -> IO () waitAndPong m = do
socket <- listenOn (PortNumber 8000) putMVar m ()
(handle,_,_) <- accept socket hSetBuffering handle LineBuffering
incoming <- hGetLine handle putStrLn ("> " ++ incoming) hPutStrLn handle "pong"
-- The basic client ping :: MVar () -> IO () ping m = do _ <- takeMVar m handle <- connectTo "localhost" (PortNumber 8000)
hSetBuffering handle LineBuffering hPutStrLn handle "ping" incoming <- hGetLine handle putStrLn ("< " ++ incoming)
On Thu, Jan 20, 2011 at 6:17 PM, Michael Litchard <michael@schmong.org>wrote:
I tried this as an example and got the following error when running.
net.exe: connect: failed (Connection refused (WSAECONNREFUSED))
Firewall is off, running as administrator
Windows is Windows 7 Enterprise.
Advice on what to do next is appreciated
On Tue, Nov 2, 2010 at 1:24 PM, Nils Schweinsberg <ml@n-sch.de> wrote:
Am 02.11.2010 19:57, schrieb Michael Litchard:
got any urls with examples?
Sure, see this short server-client-ping-pong application.
By the way, I noticed that you don't need withSocketsDo on windows 7, but I guess it's there for a reason for older windows versions. :)
import Control.Concurrent import Network import System.IO
main :: IO () main = withSocketsDo $ do forkIO waitAndPong ping
-- The basic server waitAndPong :: IO () waitAndPong = do socket <- listenOn (PortNumber 1234) (handle,_,_) <- accept socket hSetBuffering handle LineBuffering incoming <- hGetLine handle putStrLn ("> " ++ incoming) hPutStrLn handle "pong"
-- The basic client ping :: IO () ping = do handle <- connectTo "localhost" (PortNumber 1234) hSetBuffering handle LineBuffering hPutStrLn handle "ping" incoming <- hGetLine handle putStrLn ("< " ++ incoming)
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
On 11-01-21 03:13 AM, Tako Schotanus wrote:
Just starting out here so I don't know what I'm doing yet, but this one doesn't compile for me.
ping.hs:19:13: parse error on input `<-'
The original code contains no parse error. When you tranfer it to your editor, you may accidentally change indentation, which causes such parse errors. Some editors add tabs behind your back to confound indentation further.
You're probably right, I just tried at again at home and here it works. Thanks, -Tako On Fri, Jan 21, 2011 at 23:23, Albert Y. C. Lai <trebla@vex.net> wrote:
On 11-01-21 03:13 AM, Tako Schotanus wrote:
Just starting out here so I don't know what I'm doing yet, but this one doesn't compile for me.
ping.hs:19:13: parse error on input `<-'
The original code contains no parse error.
When you tranfer it to your editor, you may accidentally change indentation, which causes such parse errors.
Some editors add tabs behind your back to confound indentation further.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (6)
-
Albert Y. C. Lai -
Antoine Latter -
Michael Litchard -
Nils Schweinsberg -
Paulo Tanimoto -
Tako Schotanus