| Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.Gio.Objects.SocketAddress
Description
SocketAddress is the equivalent of struct sockaddr in the BSD
sockets API. This is an abstract class; use InetSocketAddress
for internet sockets, or UnixSocketAddress for UNIX domain sockets.
- newtype SocketAddress = SocketAddress (ManagedPtr SocketAddress)
- class GObject o => IsSocketAddress o
- toSocketAddress :: (MonadIO m, IsSocketAddress o) => o -> m SocketAddress
- noSocketAddress :: Maybe SocketAddress
- socketAddressGetFamily :: (HasCallStack, MonadIO m, IsSocketAddress a) => a -> m SocketFamily
- socketAddressGetNativeSize :: (HasCallStack, MonadIO m, IsSocketAddress a) => a -> m Int64
- socketAddressNewFromNative :: (HasCallStack, MonadIO m) => Ptr () -> Word64 -> m SocketAddress
- socketAddressToNative :: (HasCallStack, MonadIO m, IsSocketAddress a) => a -> Ptr () -> Word64 -> m ()
- getSocketAddressFamily :: (MonadIO m, IsSocketAddress o) => o -> m SocketFamily
Exported types
newtype SocketAddress Source #
Constructors
| SocketAddress (ManagedPtr SocketAddress) |
class GObject o => IsSocketAddress o Source #
toSocketAddress :: (MonadIO m, IsSocketAddress o) => o -> m SocketAddress Source #
Methods
getFamily
socketAddressGetFamily Source #
Arguments
| :: (HasCallStack, MonadIO m, IsSocketAddress a) | |
| => a |
|
| -> m SocketFamily | Returns: the socket family type of |
Gets the socket family type of address.
Since: 2.22
getNativeSize
socketAddressGetNativeSize Source #
Arguments
| :: (HasCallStack, MonadIO m, IsSocketAddress a) | |
| => a |
|
| -> m Int64 | Returns: the size of the native struct sockaddr that
|
Gets the size of address's native struct sockaddr.
You can use this to allocate memory to pass to
socketAddressToNative.
Since: 2.22
newFromNative
socketAddressNewFromNative Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Ptr () |
|
| -> Word64 |
|
| -> m SocketAddress | Returns: a new |
Creates a SocketAddress subclass corresponding to the native
struct sockaddr native.
Since: 2.22
toNative
socketAddressToNative Source #
Arguments
| :: (HasCallStack, MonadIO m, IsSocketAddress a) | |
| => a |
|
| -> Ptr () |
|
| -> Word64 |
|
| -> m () | (Can throw |
Converts a SocketAddress to a native struct sockaddr, which can
be passed to low-level functions like connect() or bind().
If not enough space is available, a IOErrorEnumNoSpace error
is returned. If the address type is not known on the system
then a IOErrorEnumNotSupported error is returned.
Since: 2.22
Properties
family
getSocketAddressFamily :: (MonadIO m, IsSocketAddress o) => o -> m SocketFamily Source #