Network trouble: what to do?

So in my quest to create bindings to BlueZ in Haskell, I've hit a bit of a snag: sockets programming. In C, you can use the standard sockets library and just pass around addresses as arrays of 6 bytes instead of arrays of 4 bytes like you normally would. The problem I'm having is that in Network.Socket, there's no such wiggle room and you have to either provide a Word32 or four Word32's to represent the address. Is there a way around this that I just haven't seen, or should I write a patch to Network to add an extra constructor to SockAddr and code to handle it? Cheers, Creighton

On Wed, Oct 15, 2008 at 6:54 AM, Creighton Hogg
Is there a way around this that I just haven't seen, or should I write a patch to Network to add an extra constructor to SockAddr and code to handle it?
Linux and Windows support Bluetooth sockets, but they have different ideas of what the address family is called (AF_BTH vs AF_BLUETOOTH). Less popular platforms are all over the map: some (Solaris) have no support, others (NetBSD) don't use sockets for Bluetooth. I don't think that a patch to Network.Socket is the way to go for this, since it won't be portable enough. Perhaps a Network.Bluetooth package is in order to hide all the platform-specific gunk.

On Wed, Oct 15, 2008 at 12:26 PM, Bryan O'Sullivan
On Wed, Oct 15, 2008 at 6:54 AM, Creighton Hogg
wrote: Is there a way around this that I just haven't seen, or should I write a patch to Network to add an extra constructor to SockAddr and code to handle it?
Linux and Windows support Bluetooth sockets, but they have different ideas of what the address family is called (AF_BTH vs AF_BLUETOOTH). Less popular platforms are all over the map: some (Solaris) have no support, others (NetBSD) don't use sockets for Bluetooth. I don't think that a patch to Network.Socket is the way to go for this, since it won't be portable enough. Perhaps a Network.Bluetooth package is in order to hide all the platform-specific gunk.
Ah, I've only ever used Bluetooth on Linux and didn't realize how different it was between platforms. I think you're right, then, and a Network.Bluetooth would be a good idea. Cheers, Creighton
participants (2)
-
Bryan O'Sullivan
-
Creighton Hogg