main = do
s <- bindPortTCP 3000 "*4"
_ <- accept s
return ()
An IllegalArgumentException will be thrown because the Channel doesn't support the specified operation, and in this case, accept.
bindPortTCP in streaming-commons library passes NS.Stream as socket type and, as a result, gets a NetworkChannel in return. But only ServerSocketChannel supports accept, so there the problem is.
The solution would be to just change the NS.Stream to NS.ServerSocket NS.Stream. Also, ServerSocketChannel doesn't support TCP_NODELAY, so the options need be changed.
In the following simple code:
An
IllegalArgumentException
will be thrown because theChannel
doesn't support the specified operation, and in this case,accept
.bindPortTCP
instreaming-commons
library passesNS.Stream
as socket type and, as a result, gets aNetworkChannel
in return. But onlyServerSocketChannel
supportsaccept
, so there the problem is.The solution would be to just change the
NS.Stream
toNS.ServerSocket NS.Stream
. Also,ServerSocketChannel
doesn't supportTCP_NODELAY
, so the options need be changed.