<commit_before>module Main where

import Network
import Control.Concurrent
import System.IO

-- NOTE: this test depends on non-blocking I/O support,
-- which win32 doesn't support. Rather than having the
-- test program block, we fail to initialise WinSock
-- (via withSocketsDo) here so that the test will fall over
-- (and repeatedly remind us to implement Win32 support
-- for non-blocking I/O !)

main = {- withSocketsDo $ -} do
   forkIO server
   yield
   h <- connectTo "localhost" (PortNumber 22222)
   l <- hGetLine h
   hClose h
   print l
 where
   server = do
	  s <- listenOn (PortNumber 22222)
	  (h, host, port) <- accept s
	  hPutStrLn h "hello"
	  hClose h
<commit_msg>Sleep for a second before trying to connect in the net001 test With just a yield, in threaded1/2 ways the client was sometimes trying to connect before the server was listening.<commit_after>module Main where

import Network
import Control.Concurrent
import System.IO

-- NOTE: this test depends on non-blocking I/O support,
-- which win32 doesn't support. Rather than having the
-- test program block, we fail to initialise WinSock
-- (via withSocketsDo) here so that the test will fall over
-- (and repeatedly remind us to implement Win32 support
-- for non-blocking I/O !)

main = {- withSocketsDo $ -} do
   forkIO server
   threadDelay 1000000
   h <- connectTo "localhost" (PortNumber 22222)
   l <- hGetLine h
   hClose h
   print l
 where
   server = do
	  s <- listenOn (PortNumber 22222)
	  (h, host, port) <- accept s
	  hPutStrLn h "hello"
	  hClose h

{'fraction_non_alphanumeric': 0.07677419354838709, 'fraction_numerical': 0.025806451612903226, 'mean_word_length': 3.214673913043478, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7009353', 'n_tokens_mistral': 515, 'n_tokens_neox': 457, 'n_words': 209}