问题描述
Network.Socket.ByteString
和Network.Socket.ByteString.Lazy
都具有send
功能.
Network.Socket.ByteString
具有sendTo
功能,但Network.Socket.ByteString.Lazy
没有.
如何将Network.Socket.ByteString
的sendTo与Lazy.ByteString 或 Network.Socket.ByteString.Lazy
的send
函数一起使用. (即我如何告诉它将数据包发送到哪里.)
How can I use Network.Socket.ByteString
's sendTo with a Lazy.ByteString or Network.Socket.ByteString.Lazy
's send
function. (i.e. how do I tell it where to send the packet.)
任何人都可以推荐有关Haskell的Strings,BytesStrings的很好的教程. Lazy.ByteStrings等,我发现它们非常令人困惑(来自Java/Python背景).
Can anyone recommend a good tutorial on Haskell's Strings, BytesStrings. Lazy.ByteStrings, etc. as I find them very confusing (coming from a Java/Python background).
推荐答案
请注意,sendTo在发送的数据中是严格的,因此没有真正的逻辑将其传递为惰性字节串.这就是为什么该函数仅存在于严格的字节串上的原因.
Note that sendTo is strict in the data sent, and so there's no real logic to passing it a lazy bytestring. That's why the function only exists on strict bytestrings.
这篇关于Network.Socket.ByteString.Lazy的sendTo在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!