Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
GI.Gio.Objects.Socket
Contents
- Exported types
- Methods
- accept
- bind
- checkConnectResult
- close
- conditionCheck
- conditionTimedWait
- conditionWait
- connect
- connectionFactoryCreateConnection
- getAvailableBytes
- getBlocking
- getBroadcast
- getCredentials
- getFamily
- getFd
- getKeepalive
- getListenBacklog
- getLocalAddress
- getMulticastLoopback
- getMulticastTtl
- getOption
- getProtocol
- getRemoteAddress
- getSocketType
- getTimeout
- getTtl
- isClosed
- isConnected
- joinMulticastGroup
- joinMulticastGroupSsm
- leaveMulticastGroup
- leaveMulticastGroupSsm
- listen
- new
- newFromFd
- receive
- receiveBytes
- receiveBytesFrom
- receiveFrom
- receiveMessage
- receiveMessages
- receiveWithBlocking
- send
- sendMessage
- sendMessageWithTimeout
- sendMessages
- sendTo
- sendWithBlocking
- setBlocking
- setBroadcast
- setKeepalive
- setListenBacklog
- setMulticastLoopback
- setMulticastTtl
- setOption
- setTimeout
- setTtl
- shutdown
- speaksIpv4
- Properties
Description
A GSocket
is a low-level networking primitive. It is a more or less
direct mapping of the BSD socket API in a portable GObject based API.
It supports both the UNIX socket implementations and winsock2 on Windows.
GSocket
is the platform independent base upon which the higher level
network primitives are based. Applications are not typically meant to
use it directly, but rather through classes like SocketClient
,
SocketService
and SocketConnection
. However there may
be cases where direct use of GSocket
is useful.
GSocket
implements the Initable
interface, so if it is manually
constructed by e.g. Object
.new
() you must call
initableInit
and check the results before using the object.
This is done automatically in socketNew
and
socketNewFromFd
, so these functions can return NULL
.
Sockets operate in two general modes, blocking or non-blocking. When
in blocking mode all operations (which don’t take an explicit blocking
parameter) block until the requested operation
is finished or there is an error. In non-blocking mode all calls that
would block return immediately with a G_IO_ERROR_WOULD_BLOCK
error.
To know when a call would successfully run you can call
socketConditionCheck
, or socketConditionWait
.
You can also use Socket
.create_source
() and attach it to a
[typegLib
.MainContext] to get callbacks when I/O is possible.
Note that all sockets are always set to non blocking mode in the system, and
blocking mode is emulated in GSocket
.
When working in non-blocking mode applications should always be able to
handle getting a G_IO_ERROR_WOULD_BLOCK
error even when some other
function said that I/O was possible. This can easily happen in case
of a race condition in the application, but it can also happen for other
reasons. For instance, on Windows a socket is always seen as writable
until a write returns G_IO_ERROR_WOULD_BLOCK
.
GSocket
s can be either connection oriented or datagram based.
For connection oriented types you must first establish a connection by
either connecting to an address or accepting a connection from another
address. For connectionless socket types the target/source address is
specified or received in each I/O operation.
All socket file descriptors are set to be close-on-exec.
Note that creating a GSocket
causes the signal SIGPIPE
to be
ignored for the remainder of the program. If you are writing a
command-line utility that uses GSocket
, you may need to take into
account the fact that your program will not automatically be killed
if it tries to write to stdout
after it has been closed.
Like most other APIs in GLib, GSocket
is not inherently thread safe. To use
a GSocket
concurrently from multiple threads, you must implement your own
locking.
Nagle’s algorithm
Since GLib 2.80, GSocket
will automatically set the TCP_NODELAY
option on
all G_SOCKET_TYPE_STREAM
sockets. This disables
Nagle’s algorithm as it
typically does more harm than good on modern networks.
If your application needs Nagle’s algorithm enabled, call
socketSetOption
after constructing a GSocket
to enable it:
c code
socket = g_socket_new (…, G_SOCKET_TYPE_STREAM, …); if (socket != NULL) { g_socket_set_option (socket, IPPROTO_TCP, TCP_NODELAY, FALSE, &local_error); // handle error if needed }
Since: 2.22
Synopsis
- newtype Socket = Socket (ManagedPtr Socket)
- class (GObject o, IsDescendantOf Socket o) => IsSocket o
- toSocket :: (MonadIO m, IsSocket o) => o -> m Socket
- type family ResolveSocketMethod (t :: Symbol) o where ...
- data SocketAcceptMethodInfo
- socketAccept :: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) => a -> Maybe b -> m Socket
- data SocketBindMethodInfo
- socketBind :: (HasCallStack, MonadIO m, IsSocket a, IsSocketAddress b) => a -> b -> Bool -> m ()
- data SocketCheckConnectResultMethodInfo
- socketCheckConnectResult :: (HasCallStack, MonadIO m, IsSocket a) => a -> m ()
- data SocketCloseMethodInfo
- socketClose :: (HasCallStack, MonadIO m, IsSocket a) => a -> m ()
- data SocketConditionCheckMethodInfo
- socketConditionCheck :: (HasCallStack, MonadIO m, IsSocket a) => a -> [IOCondition] -> m [IOCondition]
- data SocketConditionTimedWaitMethodInfo
- socketConditionTimedWait :: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) => a -> [IOCondition] -> Int64 -> Maybe b -> m ()
- data SocketConditionWaitMethodInfo
- socketConditionWait :: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) => a -> [IOCondition] -> Maybe b -> m ()
- data SocketConnectMethodInfo
- socketConnect :: (HasCallStack, MonadIO m, IsSocket a, IsSocketAddress b, IsCancellable c) => a -> b -> Maybe c -> m ()
- data SocketConnectionFactoryCreateConnectionMethodInfo
- socketConnectionFactoryCreateConnection :: (HasCallStack, MonadIO m, IsSocket a) => a -> m SocketConnection
- data SocketGetAvailableBytesMethodInfo
- socketGetAvailableBytes :: (HasCallStack, MonadIO m, IsSocket a) => a -> m Int64
- data SocketGetBlockingMethodInfo
- socketGetBlocking :: (HasCallStack, MonadIO m, IsSocket a) => a -> m Bool
- data SocketGetBroadcastMethodInfo
- socketGetBroadcast :: (HasCallStack, MonadIO m, IsSocket a) => a -> m Bool
- data SocketGetCredentialsMethodInfo
- socketGetCredentials :: (HasCallStack, MonadIO m, IsSocket a) => a -> m Credentials
- data SocketGetFamilyMethodInfo
- socketGetFamily :: (HasCallStack, MonadIO m, IsSocket a) => a -> m SocketFamily
- data SocketGetFdMethodInfo
- socketGetFd :: (HasCallStack, MonadIO m, IsSocket a) => a -> m Int32
- data SocketGetKeepaliveMethodInfo
- socketGetKeepalive :: (HasCallStack, MonadIO m, IsSocket a) => a -> m Bool
- data SocketGetListenBacklogMethodInfo
- socketGetListenBacklog :: (HasCallStack, MonadIO m, IsSocket a) => a -> m Int32
- data SocketGetLocalAddressMethodInfo
- socketGetLocalAddress :: (HasCallStack, MonadIO m, IsSocket a) => a -> m SocketAddress
- data SocketGetMulticastLoopbackMethodInfo
- socketGetMulticastLoopback :: (HasCallStack, MonadIO m, IsSocket a) => a -> m Bool
- data SocketGetMulticastTtlMethodInfo
- socketGetMulticastTtl :: (HasCallStack, MonadIO m, IsSocket a) => a -> m Word32
- data SocketGetOptionMethodInfo
- socketGetOption :: (HasCallStack, MonadIO m, IsSocket a) => a -> Int32 -> Int32 -> m Int32
- data SocketGetProtocolMethodInfo
- socketGetProtocol :: (HasCallStack, MonadIO m, IsSocket a) => a -> m SocketProtocol
- data SocketGetRemoteAddressMethodInfo
- socketGetRemoteAddress :: (HasCallStack, MonadIO m, IsSocket a) => a -> m SocketAddress
- data SocketGetSocketTypeMethodInfo
- socketGetSocketType :: (HasCallStack, MonadIO m, IsSocket a) => a -> m SocketType
- data SocketGetTimeoutMethodInfo
- socketGetTimeout :: (HasCallStack, MonadIO m, IsSocket a) => a -> m Word32
- data SocketGetTtlMethodInfo
- socketGetTtl :: (HasCallStack, MonadIO m, IsSocket a) => a -> m Word32
- data SocketIsClosedMethodInfo
- socketIsClosed :: (HasCallStack, MonadIO m, IsSocket a) => a -> m Bool
- data SocketIsConnectedMethodInfo
- socketIsConnected :: (HasCallStack, MonadIO m, IsSocket a) => a -> m Bool
- data SocketJoinMulticastGroupMethodInfo
- socketJoinMulticastGroup :: (HasCallStack, MonadIO m, IsSocket a, IsInetAddress b) => a -> b -> Bool -> Maybe Text -> m ()
- data SocketJoinMulticastGroupSsmMethodInfo
- socketJoinMulticastGroupSsm :: (HasCallStack, MonadIO m, IsSocket a, IsInetAddress b, IsInetAddress c) => a -> b -> Maybe c -> Maybe Text -> m ()
- data SocketLeaveMulticastGroupMethodInfo
- socketLeaveMulticastGroup :: (HasCallStack, MonadIO m, IsSocket a, IsInetAddress b) => a -> b -> Bool -> Maybe Text -> m ()
- data SocketLeaveMulticastGroupSsmMethodInfo
- socketLeaveMulticastGroupSsm :: (HasCallStack, MonadIO m, IsSocket a, IsInetAddress b, IsInetAddress c) => a -> b -> Maybe c -> Maybe Text -> m ()
- data SocketListenMethodInfo
- socketListen :: (HasCallStack, MonadIO m, IsSocket a) => a -> m ()
- socketNew :: (HasCallStack, MonadIO m) => SocketFamily -> SocketType -> SocketProtocol -> m Socket
- socketNewFromFd :: (HasCallStack, MonadIO m) => Int32 -> m Socket
- data SocketReceiveMethodInfo
- socketReceive :: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) => a -> ByteString -> Maybe b -> m (Int64, ByteString)
- data SocketReceiveBytesMethodInfo
- socketReceiveBytes :: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) => a -> CSize -> Int64 -> Maybe b -> m Bytes
- data SocketReceiveBytesFromMethodInfo
- socketReceiveBytesFrom :: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) => a -> CSize -> Int64 -> Maybe b -> m (Bytes, SocketAddress)
- data SocketReceiveFromMethodInfo
- socketReceiveFrom :: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) => a -> ByteString -> Maybe b -> m (Int64, SocketAddress, ByteString)
- data SocketReceiveMessageMethodInfo
- socketReceiveMessage :: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) => a -> [InputVector] -> Int32 -> Maybe b -> m (Int64, SocketAddress, Maybe [SocketControlMessage], Int32)
- data SocketReceiveMessagesMethodInfo
- socketReceiveMessages :: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) => a -> [InputMessage] -> Int32 -> Maybe b -> m Int32
- data SocketReceiveWithBlockingMethodInfo
- socketReceiveWithBlocking :: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) => a -> ByteString -> Bool -> Maybe b -> m (Int64, ByteString)
- data SocketSendMethodInfo
- socketSend :: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) => a -> ByteString -> Maybe b -> m Int64
- data SocketSendMessageMethodInfo
- socketSendMessage :: (HasCallStack, MonadIO m, IsSocket a, IsSocketAddress b, IsCancellable c) => a -> Maybe b -> [OutputVector] -> Maybe [SocketControlMessage] -> Int32 -> Maybe c -> m Int64
- data SocketSendMessageWithTimeoutMethodInfo
- socketSendMessageWithTimeout :: (HasCallStack, MonadIO m, IsSocket a, IsSocketAddress b, IsCancellable c) => a -> Maybe b -> [OutputVector] -> Maybe [SocketControlMessage] -> Int32 -> Int64 -> Maybe c -> m (PollableReturn, CSize)
- data SocketSendMessagesMethodInfo
- socketSendMessages :: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) => a -> [OutputMessage] -> Int32 -> Maybe b -> m Int32
- data SocketSendToMethodInfo
- socketSendTo :: (HasCallStack, MonadIO m, IsSocket a, IsSocketAddress b, IsCancellable c) => a -> Maybe b -> ByteString -> Maybe c -> m Int64
- data SocketSendWithBlockingMethodInfo
- socketSendWithBlocking :: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) => a -> ByteString -> Bool -> Maybe b -> m Int64
- data SocketSetBlockingMethodInfo
- socketSetBlocking :: (HasCallStack, MonadIO m, IsSocket a) => a -> Bool -> m ()
- data SocketSetBroadcastMethodInfo
- socketSetBroadcast :: (HasCallStack, MonadIO m, IsSocket a) => a -> Bool -> m ()
- data SocketSetKeepaliveMethodInfo
- socketSetKeepalive :: (HasCallStack, MonadIO m, IsSocket a) => a -> Bool -> m ()
- data SocketSetListenBacklogMethodInfo
- socketSetListenBacklog :: (HasCallStack, MonadIO m, IsSocket a) => a -> Int32 -> m ()
- data SocketSetMulticastLoopbackMethodInfo
- socketSetMulticastLoopback :: (HasCallStack, MonadIO m, IsSocket a) => a -> Bool -> m ()
- data SocketSetMulticastTtlMethodInfo
- socketSetMulticastTtl :: (HasCallStack, MonadIO m, IsSocket a) => a -> Word32 -> m ()
- data SocketSetOptionMethodInfo
- socketSetOption :: (HasCallStack, MonadIO m, IsSocket a) => a -> Int32 -> Int32 -> Int32 -> m ()
- data SocketSetTimeoutMethodInfo
- socketSetTimeout :: (HasCallStack, MonadIO m, IsSocket a) => a -> Word32 -> m ()
- data SocketSetTtlMethodInfo
- socketSetTtl :: (HasCallStack, MonadIO m, IsSocket a) => a -> Word32 -> m ()
- data SocketShutdownMethodInfo
- socketShutdown :: (HasCallStack, MonadIO m, IsSocket a) => a -> Bool -> Bool -> m ()
- data SocketSpeaksIpv4MethodInfo
- socketSpeaksIpv4 :: (HasCallStack, MonadIO m, IsSocket a) => a -> m Bool
- data SocketBlockingPropertyInfo
- constructSocketBlocking :: (IsSocket o, MonadIO m) => Bool -> m (GValueConstruct o)
- getSocketBlocking :: (MonadIO m, IsSocket o) => o -> m Bool
- setSocketBlocking :: (MonadIO m, IsSocket o) => o -> Bool -> m ()
- socketBlocking :: AttrLabelProxy "blocking"
- data SocketBroadcastPropertyInfo
- constructSocketBroadcast :: (IsSocket o, MonadIO m) => Bool -> m (GValueConstruct o)
- getSocketBroadcast :: (MonadIO m, IsSocket o) => o -> m Bool
- setSocketBroadcast :: (MonadIO m, IsSocket o) => o -> Bool -> m ()
- socketBroadcast :: AttrLabelProxy "broadcast"
- data SocketFamilyPropertyInfo
- constructSocketFamily :: (IsSocket o, MonadIO m) => SocketFamily -> m (GValueConstruct o)
- getSocketFamily :: (MonadIO m, IsSocket o) => o -> m SocketFamily
- socketFamily :: AttrLabelProxy "family"
- data SocketFdPropertyInfo
- constructSocketFd :: (IsSocket o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getSocketFd :: (MonadIO m, IsSocket o) => o -> m Int32
- socketFd :: AttrLabelProxy "fd"
- data SocketKeepalivePropertyInfo
- constructSocketKeepalive :: (IsSocket o, MonadIO m) => Bool -> m (GValueConstruct o)
- getSocketKeepalive :: (MonadIO m, IsSocket o) => o -> m Bool
- setSocketKeepalive :: (MonadIO m, IsSocket o) => o -> Bool -> m ()
- socketKeepalive :: AttrLabelProxy "keepalive"
- data SocketListenBacklogPropertyInfo
- constructSocketListenBacklog :: (IsSocket o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getSocketListenBacklog :: (MonadIO m, IsSocket o) => o -> m Int32
- setSocketListenBacklog :: (MonadIO m, IsSocket o) => o -> Int32 -> m ()
- socketListenBacklog :: AttrLabelProxy "listenBacklog"
- data SocketLocalAddressPropertyInfo
- getSocketLocalAddress :: (MonadIO m, IsSocket o) => o -> m (Maybe SocketAddress)
- socketLocalAddress :: AttrLabelProxy "localAddress"
- data SocketMulticastLoopbackPropertyInfo
- constructSocketMulticastLoopback :: (IsSocket o, MonadIO m) => Bool -> m (GValueConstruct o)
- getSocketMulticastLoopback :: (MonadIO m, IsSocket o) => o -> m Bool
- setSocketMulticastLoopback :: (MonadIO m, IsSocket o) => o -> Bool -> m ()
- socketMulticastLoopback :: AttrLabelProxy "multicastLoopback"
- data SocketMulticastTtlPropertyInfo
- constructSocketMulticastTtl :: (IsSocket o, MonadIO m) => Word32 -> m (GValueConstruct o)
- getSocketMulticastTtl :: (MonadIO m, IsSocket o) => o -> m Word32
- setSocketMulticastTtl :: (MonadIO m, IsSocket o) => o -> Word32 -> m ()
- socketMulticastTtl :: AttrLabelProxy "multicastTtl"
- data SocketProtocolPropertyInfo
- constructSocketProtocol :: (IsSocket o, MonadIO m) => SocketProtocol -> m (GValueConstruct o)
- getSocketProtocol :: (MonadIO m, IsSocket o) => o -> m SocketProtocol
- socketProtocol :: AttrLabelProxy "protocol"
- data SocketRemoteAddressPropertyInfo
- getSocketRemoteAddress :: (MonadIO m, IsSocket o) => o -> m (Maybe SocketAddress)
- socketRemoteAddress :: AttrLabelProxy "remoteAddress"
- data SocketTimeoutPropertyInfo
- constructSocketTimeout :: (IsSocket o, MonadIO m) => Word32 -> m (GValueConstruct o)
- getSocketTimeout :: (MonadIO m, IsSocket o) => o -> m Word32
- setSocketTimeout :: (MonadIO m, IsSocket o) => o -> Word32 -> m ()
- socketTimeout :: AttrLabelProxy "timeout"
- data SocketTtlPropertyInfo
- constructSocketTtl :: (IsSocket o, MonadIO m) => Word32 -> m (GValueConstruct o)
- getSocketTtl :: (MonadIO m, IsSocket o) => o -> m Word32
- setSocketTtl :: (MonadIO m, IsSocket o) => o -> Word32 -> m ()
- socketTtl :: AttrLabelProxy "ttl"
- data SocketTypePropertyInfo
- constructSocketType :: (IsSocket o, MonadIO m) => SocketType -> m (GValueConstruct o)
- getSocketType :: (MonadIO m, IsSocket o) => o -> m SocketType
- socketType :: AttrLabelProxy "type"
Exported types
Memory-managed wrapper type.
Constructors
Socket (ManagedPtr Socket) |
Instances
class (GObject o, IsDescendantOf Socket o) => IsSocket o Source #
Instances
(GObject o, IsDescendantOf Socket o) => IsSocket o Source # | |
Defined in GI.Gio.Objects.Socket |
Methods
Click to display all available methods, including inherited ones
Methods
accept, bind, bindProperty, bindPropertyFull, checkConnectResult, close, conditionCheck, conditionTimedWait, conditionWait, connect, connectionFactoryCreateConnection, createSource, forceFloating, freezeNotify, getv, init, isClosed, isConnected, isFloating, joinMulticastGroup, joinMulticastGroupSsm, leaveMulticastGroup, leaveMulticastGroupSsm, listen, notify, notifyByPspec, receive, receiveBytes, receiveBytesFrom, receiveFrom, receiveMessage, receiveMessages, receiveWithBlocking, ref, refSink, runDispose, send, sendMessage, sendMessageWithTimeout, sendMessages, sendTo, sendWithBlocking, shutdown, speaksIpv4, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getAvailableBytes, getBlocking, getBroadcast, getCredentials, getData, getFamily, getFd, getKeepalive, getListenBacklog, getLocalAddress, getMulticastLoopback, getMulticastTtl, getOption, getProperty, getProtocol, getQdata, getRemoteAddress, getSocketType, getTimeout, getTtl.
Setters
setBlocking, setBroadcast, setData, setDataFull, setKeepalive, setListenBacklog, setMulticastLoopback, setMulticastTtl, setOption, setProperty, setTimeout, setTtl.
type family ResolveSocketMethod (t :: Symbol) o where ... Source #
Equations
accept
data SocketAcceptMethodInfo Source #
Instances
(signature ~ (Maybe b -> m Socket), MonadIO m, IsSocket a, IsCancellable b) => OverloadedMethod SocketAcceptMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketAcceptMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> m Socket | Returns: a new |
Accept incoming connections on a connection-based socket. This removes
the first outstanding connection request from the listening socket and
creates a Socket
object for it.
The socket
must be bound to a local address with socketBind
and
must be listening for incoming connections (socketListen
).
If there are no outstanding connections then the operation will block
or return IOErrorEnumWouldBlock
if non-blocking I/O is enabled.
To be notified of an incoming connection, wait for the IOConditionIn
condition.
Since: 2.22
bind
data SocketBindMethodInfo Source #
Instances
(signature ~ (b -> Bool -> m ()), MonadIO m, IsSocket a, IsSocketAddress b) => OverloadedMethod SocketBindMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketBindMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsSocketAddress b) | |
=> a |
|
-> b |
|
-> Bool |
|
-> m () | (Can throw |
When a socket is created it is attached to an address family, but it
doesn't have an address in this family. socketBind
assigns the
address (sometimes called name) of the socket.
It is generally required to bind to a local address before you can
receive connections. (See socketListen
and socketAccept
).
In certain situations, you may also want to bind a socket that will be
used to initiate connections, though this is not normally required.
If socket
is a TCP socket, then allowReuse
controls the setting
of the SO_REUSEADDR
socket option; normally it should be True
for
server sockets (sockets that you will eventually call
socketAccept
on), and False
for client sockets. (Failing to
set this flag on a server socket may cause socketBind
to return
IOErrorEnumAddressInUse
if the server program is stopped and then
immediately restarted.)
If socket
is a UDP socket, then allowReuse
determines whether or
not other UDP sockets can be bound to the same address at the same
time. In particular, you can have several UDP sockets bound to the
same address, and they will all receive all of the multicast and
broadcast packets sent to that address. (The behavior of unicast
UDP packets to an address with multiple listeners is not defined.)
Since: 2.22
checkConnectResult
data SocketCheckConnectResultMethodInfo Source #
Instances
(signature ~ m (), MonadIO m, IsSocket a) => OverloadedMethod SocketCheckConnectResultMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketCheckConnectResultMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketCheckConnectResult Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m () | (Can throw |
Checks and resets the pending connect error for the socket.
This is used to check for errors when socketConnect
is
used in non-blocking mode.
Since: 2.22
close
data SocketCloseMethodInfo Source #
Instances
(signature ~ m (), MonadIO m, IsSocket a) => OverloadedMethod SocketCloseMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketCloseMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m () | (Can throw |
Closes the socket, shutting down any active connection.
Closing a socket does not wait for all outstanding I/O operations to finish, so the caller should not rely on them to be guaranteed to complete even if the close returns with no error.
Once the socket is closed, all other operations will return
IOErrorEnumClosed
. Closing a socket multiple times will not
return an error.
Sockets will be automatically closed when the last reference is dropped, but you might want to call this function to make sure resources are released as early as possible.
Beware that due to the way that TCP works, it is possible for
recently-sent data to be lost if either you close a socket while the
IOConditionIn
condition is set, or else if the remote connection tries to
send something to you after you close the socket but before it has
finished reading all of the data you sent. There is no easy generic
way to avoid this problem; the easiest fix is to design the network
protocol such that the client will never send data "out of turn".
Another solution is for the server to half-close the connection by
calling socketShutdown
with only the shutdownWrite
flag set,
and then wait for the client to notice this and close its side of the
connection, after which the server can safely call socketClose
.
(This is what TcpConnection
does if you call
tcpConnectionSetGracefulDisconnect
. But of course, this
only works if the client will close its connection after the server
does.)
Since: 2.22
conditionCheck
data SocketConditionCheckMethodInfo Source #
Instances
(signature ~ ([IOCondition] -> m [IOCondition]), MonadIO m, IsSocket a) => OverloadedMethod SocketConditionCheckMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketConditionCheckMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> [IOCondition] |
|
-> m [IOCondition] | Returns: the |
Checks on the readiness of socket
to perform operations.
The operations specified in condition
are checked for and masked
against the currently-satisfied conditions on socket
. The result
is returned.
Note that on Windows, it is possible for an operation to return
IOErrorEnumWouldBlock
even immediately after
socketConditionCheck
has claimed that the socket is ready for
writing. Rather than calling socketConditionCheck
and then
writing to the socket if it succeeds, it is generally better to
simply try writing to the socket right away, and try again later if
the initial attempt returns IOErrorEnumWouldBlock
.
It is meaningless to specify IOConditionErr
or IOConditionHup
in condition;
these conditions will always be set in the output if they are true.
This call never blocks.
Since: 2.22
conditionTimedWait
data SocketConditionTimedWaitMethodInfo Source #
Instances
(signature ~ ([IOCondition] -> Int64 -> Maybe b -> m ()), MonadIO m, IsSocket a, IsCancellable b) => OverloadedMethod SocketConditionTimedWaitMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketConditionTimedWaitMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketConditionTimedWait Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) | |
=> a |
|
-> [IOCondition] |
|
-> Int64 |
|
-> Maybe b |
|
-> m () | (Can throw |
Waits for up to timeoutUs
microseconds for condition
to become true
on socket
. If the condition is met, True
is returned.
If cancellable
is cancelled before the condition is met, or if
timeoutUs
(or the socket's Socket:timeout) is reached before the
condition is met, then False
is returned and error
, if non-Nothing
,
is set to the appropriate value (IOErrorEnumCancelled
or
IOErrorEnumTimedOut
).
If you don't want a timeout, use socketConditionWait
.
(Alternatively, you can pass -1 for timeoutUs
.)
Note that although timeoutUs
is in microseconds for consistency with
other GLib APIs, this function actually only has millisecond
resolution, and the behavior is undefined if timeoutUs
is not an
exact number of milliseconds.
Since: 2.32
conditionWait
data SocketConditionWaitMethodInfo Source #
Instances
(signature ~ ([IOCondition] -> Maybe b -> m ()), MonadIO m, IsSocket a, IsCancellable b) => OverloadedMethod SocketConditionWaitMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketConditionWaitMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) | |
=> a |
|
-> [IOCondition] |
|
-> Maybe b |
|
-> m () | (Can throw |
Waits for condition
to become true on socket
. When the condition
is met, True
is returned.
If cancellable
is cancelled before the condition is met, or if the
socket has a timeout set and it is reached before the condition is
met, then False
is returned and error
, if non-Nothing
, is set to
the appropriate value (IOErrorEnumCancelled
or
IOErrorEnumTimedOut
).
See also socketConditionTimedWait
.
Since: 2.22
connect
data SocketConnectMethodInfo Source #
Instances
(signature ~ (b -> Maybe c -> m ()), MonadIO m, IsSocket a, IsSocketAddress b, IsCancellable c) => OverloadedMethod SocketConnectMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketConnectMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsSocketAddress b, IsCancellable c) | |
=> a |
|
-> b |
|
-> Maybe c |
|
-> m () | (Can throw |
Connect the socket to the specified remote address.
For connection oriented socket this generally means we attempt to make
a connection to the address
. For a connection-less socket it sets
the default address for socketSend
and discards all incoming datagrams
from other sources.
Generally connection oriented sockets can only connect once, but connection-less sockets can connect multiple times to change the default address.
If the connect call needs to do network I/O it will block, unless
non-blocking I/O is enabled. Then IOErrorEnumPending
is returned
and the user can be notified of the connection finishing by waiting
for the G_IO_OUT condition. The result of the connection must then be
checked with socketCheckConnectResult
.
Since: 2.22
connectionFactoryCreateConnection
data SocketConnectionFactoryCreateConnectionMethodInfo Source #
Instances
(signature ~ m SocketConnection, MonadIO m, IsSocket a) => OverloadedMethod SocketConnectionFactoryCreateConnectionMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketConnectionFactoryCreateConnectionMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketConnectionFactoryCreateConnection Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m SocketConnection | Returns: a |
Creates a SocketConnection
subclass of the right type for
socket
.
Since: 2.22
getAvailableBytes
data SocketGetAvailableBytesMethodInfo Source #
Instances
(signature ~ m Int64, MonadIO m, IsSocket a) => OverloadedMethod SocketGetAvailableBytesMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketGetAvailableBytesMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketGetAvailableBytes Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m Int64 | Returns: the number of bytes that can be read from the socket without blocking or truncating, or -1 on error. |
Get the amount of data pending in the OS input buffer, without blocking.
If socket
is a UDP or SCTP socket, this will return the size of
just the next packet, even if additional packets are buffered after
that one.
Note that on Windows, this function is rather inefficient in the
UDP case, and so if you know any plausible upper bound on the size
of the incoming packet, it is better to just do a
socketReceive
with a buffer of that size, rather than calling
socketGetAvailableBytes
first and then doing a receive of
exactly the right size.
Since: 2.32
getBlocking
data SocketGetBlockingMethodInfo Source #
Instances
(signature ~ m Bool, MonadIO m, IsSocket a) => OverloadedMethod SocketGetBlockingMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketGetBlockingMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m Bool |
Gets the blocking mode of the socket. For details on blocking I/O,
see socketSetBlocking
.
Since: 2.22
getBroadcast
data SocketGetBroadcastMethodInfo Source #
Instances
(signature ~ m Bool, MonadIO m, IsSocket a) => OverloadedMethod SocketGetBroadcastMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketGetBroadcastMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m Bool | Returns: the broadcast setting on |
Gets the broadcast setting on socket
; if True
,
it is possible to send packets to broadcast
addresses.
Since: 2.32
getCredentials
data SocketGetCredentialsMethodInfo Source #
Instances
(signature ~ m Credentials, MonadIO m, IsSocket a) => OverloadedMethod SocketGetCredentialsMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketGetCredentialsMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m Credentials | Returns: |
Returns the credentials of the foreign process connected to this
socket, if any (e.g. it is only supported for SocketFamilyUnix
sockets).
If this operation isn't supported on the OS, the method fails with
the IOErrorEnumNotSupported
error. On Linux this is implemented
by reading the SO_PEERCRED
option on the underlying socket.
This method can be expected to be available on the following platforms:
- Linux since GLib 2.26
- OpenBSD since GLib 2.30
- Solaris, Illumos and OpenSolaris since GLib 2.40
- NetBSD since GLib 2.42
- macOS, tvOS, iOS since GLib 2.66
Other ways to obtain credentials from a foreign peer includes the
UnixCredentialsMessage
type and
unixConnectionSendCredentials
/
unixConnectionReceiveCredentials
functions.
Since: 2.26
getFamily
data SocketGetFamilyMethodInfo Source #
Instances
(signature ~ m SocketFamily, MonadIO m, IsSocket a) => OverloadedMethod SocketGetFamilyMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketGetFamilyMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m SocketFamily | Returns: a |
Gets the socket family of the socket.
Since: 2.22
getFd
data SocketGetFdMethodInfo Source #
Instances
(signature ~ m Int32, MonadIO m, IsSocket a) => OverloadedMethod SocketGetFdMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketGetFdMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m Int32 | Returns: the file descriptor of the socket. |
Returns the underlying OS socket object. On unix this is a socket file descriptor, and on Windows this is a Winsock2 SOCKET handle. This may be useful for doing platform specific or otherwise unusual operations on the socket.
Since: 2.22
getKeepalive
data SocketGetKeepaliveMethodInfo Source #
Instances
(signature ~ m Bool, MonadIO m, IsSocket a) => OverloadedMethod SocketGetKeepaliveMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketGetKeepaliveMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m Bool |
Gets the keepalive mode of the socket. For details on this,
see socketSetKeepalive
.
Since: 2.22
getListenBacklog
data SocketGetListenBacklogMethodInfo Source #
Instances
(signature ~ m Int32, MonadIO m, IsSocket a) => OverloadedMethod SocketGetListenBacklogMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketGetListenBacklogMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketGetListenBacklog Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m Int32 | Returns: the maximum number of pending connections. |
Gets the listen backlog setting of the socket. For details on this,
see socketSetListenBacklog
.
Since: 2.22
getLocalAddress
data SocketGetLocalAddressMethodInfo Source #
Instances
(signature ~ m SocketAddress, MonadIO m, IsSocket a) => OverloadedMethod SocketGetLocalAddressMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketGetLocalAddressMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketGetLocalAddress Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m SocketAddress | Returns: a |
Try to get the local address of a bound socket. This is only useful if the socket has been bound to a local address, either explicitly or implicitly when connecting.
Since: 2.22
getMulticastLoopback
data SocketGetMulticastLoopbackMethodInfo Source #
Instances
(signature ~ m Bool, MonadIO m, IsSocket a) => OverloadedMethod SocketGetMulticastLoopbackMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketGetMulticastLoopbackMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketGetMulticastLoopback Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m Bool | Returns: the multicast loopback setting on |
Gets the multicast loopback setting on socket
; if True
(the
default), outgoing multicast packets will be looped back to
multicast listeners on the same host.
Since: 2.32
getMulticastTtl
data SocketGetMulticastTtlMethodInfo Source #
Instances
(signature ~ m Word32, MonadIO m, IsSocket a) => OverloadedMethod SocketGetMulticastTtlMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketGetMulticastTtlMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketGetMulticastTtl Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m Word32 | Returns: the multicast time-to-live setting on |
Gets the multicast time-to-live setting on socket
; see
socketSetMulticastTtl
for more details.
Since: 2.32
getOption
data SocketGetOptionMethodInfo Source #
Instances
(signature ~ (Int32 -> Int32 -> m Int32), MonadIO m, IsSocket a) => OverloadedMethod SocketGetOptionMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketGetOptionMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> Int32 |
|
-> Int32 |
|
-> m Int32 | (Can throw |
Gets the value of an integer-valued option on socket
, as with
getsockopt()
. (If you need to fetch a non-integer-valued option,
you will need to call getsockopt()
directly.)
The `<gio/gnetworking.h>` header pulls in system headers that will define most of the standard/portable socket options. For unusual socket protocols or platform-dependent options, you may need to include additional headers.
Note that even for socket options that are a single byte in size,
value
is still a pointer to a gint
variable, not a guchar
;
socketGetOption
will handle the conversion internally.
Since: 2.36
getProtocol
data SocketGetProtocolMethodInfo Source #
Instances
(signature ~ m SocketProtocol, MonadIO m, IsSocket a) => OverloadedMethod SocketGetProtocolMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketGetProtocolMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m SocketProtocol | Returns: a protocol id, or -1 if unknown |
Gets the socket protocol id the socket was created with. In case the protocol is unknown, -1 is returned.
Since: 2.22
getRemoteAddress
data SocketGetRemoteAddressMethodInfo Source #
Instances
(signature ~ m SocketAddress, MonadIO m, IsSocket a) => OverloadedMethod SocketGetRemoteAddressMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketGetRemoteAddressMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketGetRemoteAddress Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m SocketAddress | Returns: a |
Try to get the remote address of a connected socket. This is only useful for connection oriented sockets that have been connected.
Since: 2.22
getSocketType
data SocketGetSocketTypeMethodInfo Source #
Instances
(signature ~ m SocketType, MonadIO m, IsSocket a) => OverloadedMethod SocketGetSocketTypeMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketGetSocketTypeMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m SocketType | Returns: a |
Gets the socket type of the socket.
Since: 2.22
getTimeout
data SocketGetTimeoutMethodInfo Source #
Instances
(signature ~ m Word32, MonadIO m, IsSocket a) => OverloadedMethod SocketGetTimeoutMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketGetTimeoutMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m Word32 | Returns: the timeout in seconds |
Gets the timeout setting of the socket. For details on this, see
socketSetTimeout
.
Since: 2.26
getTtl
data SocketGetTtlMethodInfo Source #
Instances
(signature ~ m Word32, MonadIO m, IsSocket a) => OverloadedMethod SocketGetTtlMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketGetTtlMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m Word32 | Returns: the time-to-live setting on |
Gets the unicast time-to-live setting on socket
; see
socketSetTtl
for more details.
Since: 2.32
isClosed
data SocketIsClosedMethodInfo Source #
Instances
(signature ~ m Bool, MonadIO m, IsSocket a) => OverloadedMethod SocketIsClosedMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketIsClosedMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m Bool |
Checks whether a socket is closed.
Since: 2.22
isConnected
data SocketIsConnectedMethodInfo Source #
Instances
(signature ~ m Bool, MonadIO m, IsSocket a) => OverloadedMethod SocketIsConnectedMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketIsConnectedMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m Bool |
Check whether the socket is connected. This is only useful for connection-oriented sockets.
If using socketShutdown
, this function will return True
until the
socket has been shut down for reading and writing. If you do a non-blocking
connect, this function will not return True
until after you call
socketCheckConnectResult
.
Since: 2.22
joinMulticastGroup
data SocketJoinMulticastGroupMethodInfo Source #
Instances
(signature ~ (b -> Bool -> Maybe Text -> m ()), MonadIO m, IsSocket a, IsInetAddress b) => OverloadedMethod SocketJoinMulticastGroupMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketJoinMulticastGroupMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketJoinMulticastGroup Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsInetAddress b) | |
=> a |
|
-> b |
|
-> Bool |
|
-> Maybe Text |
|
-> m () | (Can throw |
Registers socket
to receive multicast messages sent to group
.
socket
must be a SocketTypeDatagram
socket, and must have
been bound to an appropriate interface and port with
socketBind
.
If iface
is Nothing
, the system will automatically pick an interface
to bind to based on group
.
If sourceSpecific
is True
, source-specific multicast as defined
in RFC 4604 is used. Note that on older platforms this may fail
with a IOErrorEnumNotSupported
error.
To bind to a given source-specific multicast address, use
socketJoinMulticastGroupSsm
instead.
Since: 2.32
joinMulticastGroupSsm
data SocketJoinMulticastGroupSsmMethodInfo Source #
Instances
(signature ~ (b -> Maybe c -> Maybe Text -> m ()), MonadIO m, IsSocket a, IsInetAddress b, IsInetAddress c) => OverloadedMethod SocketJoinMulticastGroupSsmMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketJoinMulticastGroupSsmMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketJoinMulticastGroupSsm Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsInetAddress b, IsInetAddress c) | |
=> a |
|
-> b |
|
-> Maybe c |
|
-> Maybe Text |
|
-> m () | (Can throw |
Registers socket
to receive multicast messages sent to group
.
socket
must be a SocketTypeDatagram
socket, and must have
been bound to an appropriate interface and port with
socketBind
.
If iface
is Nothing
, the system will automatically pick an interface
to bind to based on group
.
If sourceSpecific
is not Nothing
, use source-specific multicast as
defined in RFC 4604. Note that on older platforms this may fail
with a IOErrorEnumNotSupported
error.
Note that this function can be called multiple times for the same
group
with different sourceSpecific
in order to receive multicast
packets from more than one source.
Since: 2.56
leaveMulticastGroup
data SocketLeaveMulticastGroupMethodInfo Source #
Instances
(signature ~ (b -> Bool -> Maybe Text -> m ()), MonadIO m, IsSocket a, IsInetAddress b) => OverloadedMethod SocketLeaveMulticastGroupMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketLeaveMulticastGroupMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketLeaveMulticastGroup Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsInetAddress b) | |
=> a |
|
-> b |
|
-> Bool |
|
-> Maybe Text |
|
-> m () | (Can throw |
Removes socket
from the multicast group defined by group
, iface
,
and sourceSpecific
(which must all have the same values they had
when you joined the group).
socket
remains bound to its address and port, and can still receive
unicast messages after calling this.
To unbind to a given source-specific multicast address, use
socketLeaveMulticastGroupSsm
instead.
Since: 2.32
leaveMulticastGroupSsm
data SocketLeaveMulticastGroupSsmMethodInfo Source #
Instances
(signature ~ (b -> Maybe c -> Maybe Text -> m ()), MonadIO m, IsSocket a, IsInetAddress b, IsInetAddress c) => OverloadedMethod SocketLeaveMulticastGroupSsmMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketLeaveMulticastGroupSsmMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketLeaveMulticastGroupSsm Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsInetAddress b, IsInetAddress c) | |
=> a |
|
-> b |
|
-> Maybe c |
|
-> Maybe Text |
|
-> m () | (Can throw |
Removes socket
from the multicast group defined by group
, iface
,
and sourceSpecific
(which must all have the same values they had
when you joined the group).
socket
remains bound to its address and port, and can still receive
unicast messages after calling this.
Since: 2.56
listen
data SocketListenMethodInfo Source #
Instances
(signature ~ m (), MonadIO m, IsSocket a) => OverloadedMethod SocketListenMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketListenMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m () | (Can throw |
Marks the socket as a server socket, i.e. a socket that is used
to accept incoming requests using socketAccept
.
Before calling this the socket must be bound to a local address using
socketBind
.
To set the maximum amount of outstanding clients, use
socketSetListenBacklog
.
Since: 2.22
new
Arguments
:: (HasCallStack, MonadIO m) | |
=> SocketFamily |
|
-> SocketType |
|
-> SocketProtocol |
|
-> m Socket | Returns: a |
Creates a new Socket
with the defined family, type and protocol.
If protocol
is 0 (SocketProtocolDefault
) the default protocol type
for the family and type is used.
The protocol
is a family and type specific int that specifies what
kind of protocol to use. SocketProtocol
lists several common ones.
Many families only support one protocol, and use 0 for this, others
support several and using 0 means to use the default protocol for
the family and type.
The protocol id is passed directly to the operating
system, so you can use protocols not listed in SocketProtocol
if you
know the protocol number used for it.
Since: 2.22
newFromFd
Arguments
:: (HasCallStack, MonadIO m) | |
=> Int32 |
|
-> m Socket | Returns: a |
Creates a new Socket
from a native file descriptor
or winsock SOCKET handle.
This reads all the settings from the file descriptor so that
all properties should work. Note that the file descriptor
will be set to non-blocking mode, independent on the blocking
mode of the Socket
.
On success, the returned Socket
takes ownership of fd
. On failure, the
caller must close fd
themselves.
Since GLib 2.46, it is no longer a fatal error to call this on a non-socket
descriptor. Instead, a GError will be set with code IOErrorEnumFailed
Since: 2.22
receive
data SocketReceiveMethodInfo Source #
Instances
(signature ~ (ByteString -> Maybe b -> m (Int64, ByteString)), MonadIO m, IsSocket a, IsCancellable b) => OverloadedMethod SocketReceiveMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketReceiveMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) | |
=> a |
|
-> ByteString |
|
-> Maybe b |
|
-> m (Int64, ByteString) | Returns: Number of bytes read, or 0 if the connection was closed by
the peer, or -1 on error (Can throw |
Receive data (up to size
bytes) from a socket. This is mainly used by
connection-oriented sockets; it is identical to socketReceiveFrom
with address
set to Nothing
.
For SocketTypeDatagram
and SocketTypeSeqpacket
sockets,
socketReceive
will always read either 0 or 1 complete messages from
the socket. If the received message is too large to fit in buffer
, then
the data beyond size
bytes will be discarded, without any explicit
indication that this has occurred.
For SocketTypeStream
sockets, socketReceive
can return any
number of bytes, up to size
. If more than size
bytes have been
received, the additional data will be returned in future calls to
socketReceive
.
If the socket is in blocking mode the call will block until there
is some data to receive, the connection is closed, or there is an
error. If there is no data available and the socket is in
non-blocking mode, a IOErrorEnumWouldBlock
error will be
returned. To be notified when data is available, wait for the
IOConditionIn
condition.
On error -1 is returned and error
is set accordingly.
Since: 2.22
receiveBytes
data SocketReceiveBytesMethodInfo Source #
Instances
(signature ~ (CSize -> Int64 -> Maybe b -> m Bytes), MonadIO m, IsSocket a, IsCancellable b) => OverloadedMethod SocketReceiveBytesMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketReceiveBytesMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) | |
=> a |
|
-> CSize |
|
-> Int64 |
|
-> Maybe b |
|
-> m Bytes | Returns: a bytes buffer containing the
received bytes, or |
Receives data (up to size
bytes) from a socket.
This function is a variant of socketReceive
which returns a
Bytes
rather than a plain buffer.
Pass -1
to timeoutUs
to block indefinitely until data is received (or
the connection is closed, or there is an error). Pass 0
to use the default
timeout from Socket:timeout, or pass a positive number to wait
for that many microseconds for data before returning G_IO_ERROR_TIMED_OUT
.
Since: 2.80
receiveBytesFrom
data SocketReceiveBytesFromMethodInfo Source #
Instances
(signature ~ (CSize -> Int64 -> Maybe b -> m (Bytes, SocketAddress)), MonadIO m, IsSocket a, IsCancellable b) => OverloadedMethod SocketReceiveBytesFromMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketReceiveBytesFromMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketReceiveBytesFrom Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) | |
=> a |
|
-> CSize |
|
-> Int64 |
|
-> Maybe b |
|
-> m (Bytes, SocketAddress) | Returns: a bytes buffer containing the
received bytes, or |
Receive data (up to size
bytes) from a socket.
This function is a variant of socketReceiveFrom
which returns
a Bytes
rather than a plain buffer.
If address
is non-Nothing
then address
will be set equal to the
source address of the received packet.
The address
is owned by the caller.
Pass -1
to timeoutUs
to block indefinitely until data is received (or
the connection is closed, or there is an error). Pass 0
to use the default
timeout from Socket:timeout, or pass a positive number to wait
for that many microseconds for data before returning G_IO_ERROR_TIMED_OUT
.
Since: 2.80
receiveFrom
data SocketReceiveFromMethodInfo Source #
Instances
(signature ~ (ByteString -> Maybe b -> m (Int64, SocketAddress, ByteString)), MonadIO m, IsSocket a, IsCancellable b) => OverloadedMethod SocketReceiveFromMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketReceiveFromMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) | |
=> a |
|
-> ByteString |
|
-> Maybe b |
|
-> m (Int64, SocketAddress, ByteString) | Returns: Number of bytes read, or 0 if the connection was closed by
the peer, or -1 on error (Can throw |
Receive data (up to size
bytes) from a socket.
If address
is non-Nothing
then address
will be set equal to the
source address of the received packet.
address
is owned by the caller.
See socketReceive
for additional information.
Since: 2.22
receiveMessage
data SocketReceiveMessageMethodInfo Source #
Instances
(signature ~ ([InputVector] -> Int32 -> Maybe b -> m (Int64, SocketAddress, Maybe [SocketControlMessage], Int32)), MonadIO m, IsSocket a, IsCancellable b) => OverloadedMethod SocketReceiveMessageMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketReceiveMessageMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) | |
=> a |
|
-> [InputVector] |
|
-> Int32 |
|
-> Maybe b |
|
-> m (Int64, SocketAddress, Maybe [SocketControlMessage], Int32) | Returns: Number of bytes read, or 0 if the connection was closed by
the peer, or -1 on error (Can throw |
Receive data from a socket. For receiving multiple messages, see
socketReceiveMessages
; for easier use, see
socketReceive
and socketReceiveFrom
.
If address
is non-Nothing
then address
will be set equal to the
source address of the received packet.
address
is owned by the caller.
vector
must point to an array of InputVector
structs and
numVectors
must be the length of this array. These structs
describe the buffers that received data will be scattered into.
If numVectors
is -1, then vectors
is assumed to be terminated
by a InputVector
with a Nothing
buffer pointer.
As a special case, if numVectors
is 0 (in which case, vectors
may of course be Nothing
), then a single byte is received and
discarded. This is to facilitate the common practice of sending a
single '\0' byte for the purposes of transferring ancillary data.
messages
, if non-Nothing
, will be set to point to a newly-allocated
array of SocketControlMessage
instances or Nothing
if no such
messages was received. These correspond to the control messages
received from the kernel, one SocketControlMessage
per message
from the kernel. This array is Nothing
-terminated and must be freed
by the caller using free
after calling objectUnref
on each
element. If messages
is Nothing
, any control messages received will
be discarded.
numMessages
, if non-Nothing
, will be set to the number of control
messages received.
If both messages
and numMessages
are non-Nothing
, then
numMessages
gives the number of SocketControlMessage
instances
in messages
(ie: not including the Nothing
terminator).
flags
is an in/out parameter. The commonly available arguments
for this are available in the SocketMsgFlags
enum, but the
values there are the same as the system values, and the flags
are passed in as-is, so you can pass in system-specific flags too
(and socketReceiveMessage
may pass system-specific flags out).
Flags passed in to the parameter affect the receive operation; flags returned
out of it are relevant to the specific returned message.
As with socketReceive
, data may be discarded if socket
is
SocketTypeDatagram
or SocketTypeSeqpacket
and you do not
provide enough buffer space to read a complete message. You can pass
SocketMsgFlagsPeek
in flags
to peek at the current message without
removing it from the receive queue, but there is no portable way to find
out the length of the message other than by reading it into a
sufficiently-large buffer.
If the socket is in blocking mode the call will block until there
is some data to receive, the connection is closed, or there is an
error. If there is no data available and the socket is in
non-blocking mode, a IOErrorEnumWouldBlock
error will be
returned. To be notified when data is available, wait for the
IOConditionIn
condition.
On error -1 is returned and error
is set accordingly.
Since: 2.22
receiveMessages
data SocketReceiveMessagesMethodInfo Source #
Instances
(signature ~ ([InputMessage] -> Int32 -> Maybe b -> m Int32), MonadIO m, IsSocket a, IsCancellable b) => OverloadedMethod SocketReceiveMessagesMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketReceiveMessagesMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketReceiveMessages Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) | |
=> a |
|
-> [InputMessage] |
|
-> Int32 |
|
-> Maybe b |
|
-> m Int32 | Returns: number of messages received, or -1 on error. Note that the number
of messages received may be smaller than |
Receive multiple data messages from socket
in one go. This is the most
complicated and fully-featured version of this call. For easier use, see
socketReceive
, socketReceiveFrom
, and socketReceiveMessage
.
messages
must point to an array of InputMessage
structs and
numMessages
must be the length of this array. Each InputMessage
contains a pointer to an array of InputVector
structs describing the
buffers that the data received in each message will be written to. Using
multiple GInputVectors
is more memory-efficient than manually copying data
out of a single buffer to multiple sources, and more system-call-efficient
than making multiple calls to socketReceive
, such as in scenarios where
a lot of data packets need to be received (e.g. high-bandwidth video
streaming over RTP/UDP).
flags
modify how all messages are received. The commonly available
arguments for this are available in the SocketMsgFlags
enum, but the
values there are the same as the system values, and the flags
are passed in as-is, so you can pass in system-specific flags too. These
flags affect the overall receive operation. Flags affecting individual
messages are returned in InputMessage
.flags
.
The other members of InputMessage
are treated as described in its
documentation.
If Socket:blocking is True
the call will block until numMessages
have
been received, or the end of the stream is reached.
If Socket:blocking is False
the call will return up to numMessages
without blocking, or IOErrorEnumWouldBlock
if no messages are queued in the
operating system to be received.
In blocking mode, if Socket:timeout is positive and is reached before any
messages are received, IOErrorEnumTimedOut
is returned, otherwise up to
numMessages
are returned. (Note: This is effectively the
behaviour of MSG_WAITFORONE
with recvmmsg()
.)
To be notified when messages are available, wait for the
IOConditionIn
condition. Note though that you may still receive
IOErrorEnumWouldBlock
from socketReceiveMessages
even if you were
previously notified of a IOConditionIn
condition.
If the remote peer closes the connection, any messages queued in the
operating system will be returned, and subsequent calls to
socketReceiveMessages
will return 0 (with no error set).
On error -1 is returned and error
is set accordingly. An error will only
be returned if zero messages could be received; otherwise the number of
messages successfully received before the error will be returned.
Since: 2.48
receiveWithBlocking
data SocketReceiveWithBlockingMethodInfo Source #
Instances
(signature ~ (ByteString -> Bool -> Maybe b -> m (Int64, ByteString)), MonadIO m, IsSocket a, IsCancellable b) => OverloadedMethod SocketReceiveWithBlockingMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketReceiveWithBlockingMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketReceiveWithBlocking Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) | |
=> a |
|
-> ByteString |
|
-> Bool |
|
-> Maybe b |
|
-> m (Int64, ByteString) | Returns: Number of bytes read, or 0 if the connection was closed by
the peer, or -1 on error (Can throw |
This behaves exactly the same as socketReceive
, except that
the choice of blocking or non-blocking behavior is determined by
the blocking
argument rather than by socket
's properties.
Since: 2.26
send
data SocketSendMethodInfo Source #
Instances
(signature ~ (ByteString -> Maybe b -> m Int64), MonadIO m, IsSocket a, IsCancellable b) => OverloadedMethod SocketSendMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketSendMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) | |
=> a |
|
-> ByteString |
|
-> Maybe b |
|
-> m Int64 | Returns: Number of bytes written (which may be less than |
Tries to send size
bytes from buffer
on the socket. This is
mainly used by connection-oriented sockets; it is identical to
socketSendTo
with address
set to Nothing
.
If the socket is in blocking mode the call will block until there is
space for the data in the socket queue. If there is no space available
and the socket is in non-blocking mode a IOErrorEnumWouldBlock
error
will be returned. To be notified when space is available, wait for the
IOConditionOut
condition. Note though that you may still receive
IOErrorEnumWouldBlock
from socketSend
even if you were previously
notified of a IOConditionOut
condition. (On Windows in particular, this is
very common due to the way the underlying APIs work.)
On error -1 is returned and error
is set accordingly.
Since: 2.22
sendMessage
data SocketSendMessageMethodInfo Source #
Instances
(signature ~ (Maybe b -> [OutputVector] -> Maybe [SocketControlMessage] -> Int32 -> Maybe c -> m Int64), MonadIO m, IsSocket a, IsSocketAddress b, IsCancellable c) => OverloadedMethod SocketSendMessageMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketSendMessageMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsSocketAddress b, IsCancellable c) | |
=> a |
|
-> Maybe b |
|
-> [OutputVector] |
|
-> Maybe [SocketControlMessage] |
|
-> Int32 |
|
-> Maybe c |
|
-> m Int64 | Returns: Number of bytes written (which may be less than |
Send data to address
on socket
. For sending multiple messages see
socketSendMessages
; for easier use, see
socketSend
and socketSendTo
.
If address
is Nothing
then the message is sent to the default receiver
(set by socketConnect
).
vectors
must point to an array of OutputVector
structs and
numVectors
must be the length of this array. (If numVectors
is -1,
then vectors
is assumed to be terminated by a OutputVector
with a
Nothing
buffer pointer.) The OutputVector
structs describe the buffers
that the sent data will be gathered from. Using multiple
GOutputVectors
is more memory-efficient than manually copying
data from multiple sources into a single buffer, and more
network-efficient than making multiple calls to socketSend
.
messages
, if non-Nothing
, is taken to point to an array of numMessages
SocketControlMessage
instances. These correspond to the control
messages to be sent on the socket.
If numMessages
is -1 then messages
is treated as a Nothing
-terminated
array.
flags
modify how the message is sent. The commonly available arguments
for this are available in the SocketMsgFlags
enum, but the
values there are the same as the system values, and the flags
are passed in as-is, so you can pass in system-specific flags too.
If the socket is in blocking mode the call will block until there is
space for the data in the socket queue. If there is no space available
and the socket is in non-blocking mode a IOErrorEnumWouldBlock
error
will be returned. To be notified when space is available, wait for the
IOConditionOut
condition. Note though that you may still receive
IOErrorEnumWouldBlock
from socketSend
even if you were previously
notified of a IOConditionOut
condition. (On Windows in particular, this is
very common due to the way the underlying APIs work.)
The sum of the sizes of each OutputVector
in vectors must not be
greater than G_MAXSSIZE
. If the message can be larger than this,
then it is mandatory to use the socketSendMessageWithTimeout
function.
On error -1 is returned and error
is set accordingly.
Since: 2.22
sendMessageWithTimeout
data SocketSendMessageWithTimeoutMethodInfo Source #
Instances
(signature ~ (Maybe b -> [OutputVector] -> Maybe [SocketControlMessage] -> Int32 -> Int64 -> Maybe c -> m (PollableReturn, CSize)), MonadIO m, IsSocket a, IsSocketAddress b, IsCancellable c) => OverloadedMethod SocketSendMessageWithTimeoutMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketSendMessageWithTimeoutMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketSendMessageWithTimeout Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsSocketAddress b, IsCancellable c) | |
=> a |
|
-> Maybe b |
|
-> [OutputVector] |
|
-> Maybe [SocketControlMessage] |
|
-> Int32 |
|
-> Int64 |
|
-> Maybe c |
|
-> m (PollableReturn, CSize) | Returns: |
This behaves exactly the same as socketSendMessage
, except that
the choice of timeout behavior is determined by the timeoutUs
argument
rather than by socket
's properties.
On error PollableReturnFailed
is returned and error
is set accordingly, or
if the socket is currently not writable PollableReturnWouldBlock
is
returned. bytesWritten
will contain 0 in both cases.
Since: 2.60
sendMessages
data SocketSendMessagesMethodInfo Source #
Instances
(signature ~ ([OutputMessage] -> Int32 -> Maybe b -> m Int32), MonadIO m, IsSocket a, IsCancellable b) => OverloadedMethod SocketSendMessagesMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketSendMessagesMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) | |
=> a |
|
-> [OutputMessage] |
|
-> Int32 |
|
-> Maybe b |
|
-> m Int32 | Returns: number of messages sent, or -1 on error. Note that the number of
messages sent may be smaller than |
Send multiple data messages from socket
in one go. This is the most
complicated and fully-featured version of this call. For easier use, see
socketSend
, socketSendTo
, and socketSendMessage
.
messages
must point to an array of OutputMessage
structs and
numMessages
must be the length of this array. Each OutputMessage
contains an address to send the data to, and a pointer to an array of
OutputVector
structs to describe the buffers that the data to be sent
for each message will be gathered from. Using multiple GOutputVectors
is
more memory-efficient than manually copying data from multiple sources
into a single buffer, and more network-efficient than making multiple
calls to socketSend
. Sending multiple messages in one go avoids the
overhead of making a lot of syscalls in scenarios where a lot of data
packets need to be sent (e.g. high-bandwidth video streaming over RTP/UDP),
or where the same data needs to be sent to multiple recipients.
flags
modify how the message is sent. The commonly available arguments
for this are available in the SocketMsgFlags
enum, but the
values there are the same as the system values, and the flags
are passed in as-is, so you can pass in system-specific flags too.
If the socket is in blocking mode the call will block until there is
space for all the data in the socket queue. If there is no space available
and the socket is in non-blocking mode a IOErrorEnumWouldBlock
error
will be returned if no data was written at all, otherwise the number of
messages sent will be returned. To be notified when space is available,
wait for the IOConditionOut
condition. Note though that you may still receive
IOErrorEnumWouldBlock
from socketSend
even if you were previously
notified of a IOConditionOut
condition. (On Windows in particular, this is
very common due to the way the underlying APIs work.)
On error -1 is returned and error
is set accordingly. An error will only
be returned if zero messages could be sent; otherwise the number of messages
successfully sent before the error will be returned.
Since: 2.44
sendTo
data SocketSendToMethodInfo Source #
Instances
(signature ~ (Maybe b -> ByteString -> Maybe c -> m Int64), MonadIO m, IsSocket a, IsSocketAddress b, IsCancellable c) => OverloadedMethod SocketSendToMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketSendToMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsSocketAddress b, IsCancellable c) | |
=> a |
|
-> Maybe b |
|
-> ByteString |
|
-> Maybe c |
|
-> m Int64 | Returns: Number of bytes written (which may be less than |
Tries to send size
bytes from buffer
to address
. If address
is
Nothing
then the message is sent to the default receiver (set by
socketConnect
).
See socketSend
for additional information.
Since: 2.22
sendWithBlocking
data SocketSendWithBlockingMethodInfo Source #
Instances
(signature ~ (ByteString -> Bool -> Maybe b -> m Int64), MonadIO m, IsSocket a, IsCancellable b) => OverloadedMethod SocketSendWithBlockingMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketSendWithBlockingMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketSendWithBlocking Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) | |
=> a |
|
-> ByteString |
|
-> Bool |
|
-> Maybe b |
|
-> m Int64 | Returns: Number of bytes written (which may be less than |
This behaves exactly the same as socketSend
, except that
the choice of blocking or non-blocking behavior is determined by
the blocking
argument rather than by socket
's properties.
Since: 2.26
setBlocking
data SocketSetBlockingMethodInfo Source #
Instances
(signature ~ (Bool -> m ()), MonadIO m, IsSocket a) => OverloadedMethod SocketSetBlockingMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketSetBlockingMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets the blocking mode of the socket. In blocking mode
all operations (which don’t take an explicit blocking parameter) block until
they succeed or there is an error. In
non-blocking mode all functions return results immediately or
with a IOErrorEnumWouldBlock
error.
All sockets are created in blocking mode. However, note that the platform level socket is always non-blocking, and blocking mode is a GSocket level feature.
Since: 2.22
setBroadcast
data SocketSetBroadcastMethodInfo Source #
Instances
(signature ~ (Bool -> m ()), MonadIO m, IsSocket a) => OverloadedMethod SocketSetBroadcastMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketSetBroadcastMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether socket
should allow sending to broadcast addresses.
This is False
by default.
Since: 2.32
setKeepalive
data SocketSetKeepaliveMethodInfo Source #
Instances
(signature ~ (Bool -> m ()), MonadIO m, IsSocket a) => OverloadedMethod SocketSetKeepaliveMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketSetKeepaliveMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets or unsets the SO_KEEPALIVE
flag on the underlying socket. When
this flag is set on a socket, the system will attempt to verify that the
remote socket endpoint is still present if a sufficiently long period of
time passes with no data being exchanged. If the system is unable to
verify the presence of the remote endpoint, it will automatically close
the connection.
This option is only functional on certain kinds of sockets. (Notably,
SocketProtocolTcp
sockets.)
The exact time between pings is system- and protocol-dependent, but will normally be at least two hours. Most commonly, you would set this flag on a server socket if you want to allow clients to remain idle for long periods of time, but also want to ensure that connections are eventually garbage-collected if clients crash or become unreachable.
Since: 2.22
setListenBacklog
data SocketSetListenBacklogMethodInfo Source #
Instances
(signature ~ (Int32 -> m ()), MonadIO m, IsSocket a) => OverloadedMethod SocketSetListenBacklogMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketSetListenBacklogMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketSetListenBacklog Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> Int32 |
|
-> m () |
Sets the maximum number of outstanding connections allowed when listening on this socket. If more clients than this are connecting to the socket and the application is not handling them on time then the new connections will be refused.
Note that this must be called before socketListen
and has no
effect if called after that.
Since: 2.22
setMulticastLoopback
data SocketSetMulticastLoopbackMethodInfo Source #
Instances
(signature ~ (Bool -> m ()), MonadIO m, IsSocket a) => OverloadedMethod SocketSetMulticastLoopbackMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketSetMulticastLoopbackMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketSetMulticastLoopback Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether outgoing multicast packets will be received by sockets
listening on that multicast address on the same host. This is True
by default.
Since: 2.32
setMulticastTtl
data SocketSetMulticastTtlMethodInfo Source #
Instances
(signature ~ (Word32 -> m ()), MonadIO m, IsSocket a) => OverloadedMethod SocketSetMulticastTtlMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketSetMulticastTtlMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
socketSetMulticastTtl Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> Word32 |
|
-> m () |
Sets the time-to-live for outgoing multicast datagrams on socket
.
By default, this is 1, meaning that multicast packets will not leave
the local network.
Since: 2.32
setOption
data SocketSetOptionMethodInfo Source #
Instances
(signature ~ (Int32 -> Int32 -> Int32 -> m ()), MonadIO m, IsSocket a) => OverloadedMethod SocketSetOptionMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketSetOptionMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> m () | (Can throw |
Sets the value of an integer-valued option on socket
, as with
setsockopt()
. (If you need to set a non-integer-valued option,
you will need to call setsockopt()
directly.)
The `<gio/gnetworking.h>` header pulls in system headers that will define most of the standard/portable socket options. For unusual socket protocols or platform-dependent options, you may need to include additional headers.
Since: 2.36
setTimeout
data SocketSetTimeoutMethodInfo Source #
Instances
(signature ~ (Word32 -> m ()), MonadIO m, IsSocket a) => OverloadedMethod SocketSetTimeoutMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketSetTimeoutMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> Word32 |
|
-> m () |
Sets the time in seconds after which I/O operations on socket
will
time out if they have not yet completed.
On a blocking socket, this means that any blocking Socket
operation will time out after timeout
seconds of inactivity,
returning IOErrorEnumTimedOut
.
On a non-blocking socket, calls to socketConditionWait
will
also fail with IOErrorEnumTimedOut
after the given time. Sources
created with g_socket_create_source()
will trigger after
timeout
seconds of inactivity, with the requested condition
set, at which point calling socketReceive
, socketSend
,
socketCheckConnectResult
, etc, will fail with
IOErrorEnumTimedOut
.
If timeout
is 0 (the default), operations will never time out
on their own.
Note that if an I/O operation is interrupted by a signal, this may cause the timeout to be reset.
Since: 2.26
setTtl
data SocketSetTtlMethodInfo Source #
Instances
(signature ~ (Word32 -> m ()), MonadIO m, IsSocket a) => OverloadedMethod SocketSetTtlMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketSetTtlMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> Word32 |
|
-> m () |
Sets the time-to-live for outgoing unicast packets on socket
.
By default the platform-specific default value is used.
Since: 2.32
shutdown
data SocketShutdownMethodInfo Source #
Instances
(signature ~ (Bool -> Bool -> m ()), MonadIO m, IsSocket a) => OverloadedMethod SocketShutdownMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketShutdownMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> Bool |
|
-> Bool |
|
-> m () | (Can throw |
Shut down part or all of a full-duplex connection.
If shutdownRead
is True
then the receiving side of the connection
is shut down, and further reading is disallowed.
If shutdownWrite
is True
then the sending side of the connection
is shut down, and further writing is disallowed.
It is allowed for both shutdownRead
and shutdownWrite
to be True
.
One example where it is useful to shut down only one side of a connection is graceful disconnect for TCP connections where you close the sending side, then wait for the other side to close the connection, thus ensuring that the other side saw all sent data.
Since: 2.22
speaksIpv4
data SocketSpeaksIpv4MethodInfo Source #
Instances
(signature ~ m Bool, MonadIO m, IsSocket a) => OverloadedMethod SocketSpeaksIpv4MethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Socket Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketSpeaksIpv4MethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Socket Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m Bool | Returns: |
Checks if a socket is capable of speaking IPv4.
IPv4 sockets are capable of speaking IPv4. On some operating systems and under some combinations of circumstances IPv6 sockets are also capable of speaking IPv4. See RFC 3493 section 3.7 for more information.
No other types of sockets are currently considered as being capable of speaking IPv4.
Since: 2.22
Properties
blocking
Whether I/O on this socket is blocking.
Since: 2.22
data SocketBlockingPropertyInfo Source #
Instances
constructSocketBlocking :: (IsSocket o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “blocking
” property. This is rarely needed directly, but it is used by new
.
getSocketBlocking :: (MonadIO m, IsSocket o) => o -> m Bool Source #
Get the value of the “blocking
” property.
When overloading is enabled, this is equivalent to
get
socket #blocking
setSocketBlocking :: (MonadIO m, IsSocket o) => o -> Bool -> m () Source #
Set the value of the “blocking
” property.
When overloading is enabled, this is equivalent to
set
socket [ #blocking:=
value ]
socketBlocking :: AttrLabelProxy "blocking" Source #
broadcast
Whether the socket should allow sending to broadcast addresses.
Since: 2.32
data SocketBroadcastPropertyInfo Source #
Instances
AttrInfo SocketBroadcastPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket Associated Types
Methods attrGet :: AttrBaseTypeConstraint SocketBroadcastPropertyInfo o => o -> IO (AttrGetType SocketBroadcastPropertyInfo) # attrSet :: (AttrBaseTypeConstraint SocketBroadcastPropertyInfo o, AttrSetTypeConstraint SocketBroadcastPropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint SocketBroadcastPropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint SocketBroadcastPropertyInfo o, AttrSetTypeConstraint SocketBroadcastPropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint SocketBroadcastPropertyInfo o, AttrTransferTypeConstraint SocketBroadcastPropertyInfo b) => Proxy o -> b -> IO (AttrTransferType SocketBroadcastPropertyInfo) # | |||||||||||||||||||||||||||||||||
type AttrAllowedOps SocketBroadcastPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrBaseTypeConstraint SocketBroadcastPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrGetType SocketBroadcastPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrLabel SocketBroadcastPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrOrigin SocketBroadcastPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrSetTypeConstraint SocketBroadcastPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferType SocketBroadcastPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferTypeConstraint SocketBroadcastPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket |
constructSocketBroadcast :: (IsSocket o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “broadcast
” property. This is rarely needed directly, but it is used by new
.
getSocketBroadcast :: (MonadIO m, IsSocket o) => o -> m Bool Source #
Get the value of the “broadcast
” property.
When overloading is enabled, this is equivalent to
get
socket #broadcast
setSocketBroadcast :: (MonadIO m, IsSocket o) => o -> Bool -> m () Source #
Set the value of the “broadcast
” property.
When overloading is enabled, this is equivalent to
set
socket [ #broadcast:=
value ]
socketBroadcast :: AttrLabelProxy "broadcast" Source #
family
The socket’s address family.
Since: 2.22
data SocketFamilyPropertyInfo Source #
Instances
AttrInfo SocketFamilyPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket Associated Types
Methods attrGet :: AttrBaseTypeConstraint SocketFamilyPropertyInfo o => o -> IO (AttrGetType SocketFamilyPropertyInfo) # attrSet :: (AttrBaseTypeConstraint SocketFamilyPropertyInfo o, AttrSetTypeConstraint SocketFamilyPropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint SocketFamilyPropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint SocketFamilyPropertyInfo o, AttrSetTypeConstraint SocketFamilyPropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint SocketFamilyPropertyInfo o, AttrTransferTypeConstraint SocketFamilyPropertyInfo b) => Proxy o -> b -> IO (AttrTransferType SocketFamilyPropertyInfo) # | |||||||||||||||||||||||||||||||||
type AttrAllowedOps SocketFamilyPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrBaseTypeConstraint SocketFamilyPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrGetType SocketFamilyPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrLabel SocketFamilyPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrOrigin SocketFamilyPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrSetTypeConstraint SocketFamilyPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferType SocketFamilyPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferTypeConstraint SocketFamilyPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket |
constructSocketFamily :: (IsSocket o, MonadIO m) => SocketFamily -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “family
” property. This is rarely needed directly, but it is used by new
.
getSocketFamily :: (MonadIO m, IsSocket o) => o -> m SocketFamily Source #
Get the value of the “family
” property.
When overloading is enabled, this is equivalent to
get
socket #family
socketFamily :: AttrLabelProxy "family" Source #
fd
The socket’s file descriptor.
Since: 2.22
data SocketFdPropertyInfo Source #
Instances
AttrInfo SocketFdPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket Associated Types
Methods attrGet :: AttrBaseTypeConstraint SocketFdPropertyInfo o => o -> IO (AttrGetType SocketFdPropertyInfo) # attrSet :: (AttrBaseTypeConstraint SocketFdPropertyInfo o, AttrSetTypeConstraint SocketFdPropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint SocketFdPropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint SocketFdPropertyInfo o, AttrSetTypeConstraint SocketFdPropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint SocketFdPropertyInfo o, AttrTransferTypeConstraint SocketFdPropertyInfo b) => Proxy o -> b -> IO (AttrTransferType SocketFdPropertyInfo) # | |||||||||||||||||||||||||||||||||
type AttrAllowedOps SocketFdPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrBaseTypeConstraint SocketFdPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrGetType SocketFdPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrLabel SocketFdPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrOrigin SocketFdPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrSetTypeConstraint SocketFdPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferType SocketFdPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferTypeConstraint SocketFdPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket |
constructSocketFd :: (IsSocket o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “fd
” property. This is rarely needed directly, but it is used by new
.
getSocketFd :: (MonadIO m, IsSocket o) => o -> m Int32 Source #
Get the value of the “fd
” property.
When overloading is enabled, this is equivalent to
get
socket #fd
socketFd :: AttrLabelProxy "fd" Source #
keepalive
Whether to keep the connection alive by sending periodic pings.
Since: 2.22
data SocketKeepalivePropertyInfo Source #
Instances
AttrInfo SocketKeepalivePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket Associated Types
Methods attrGet :: AttrBaseTypeConstraint SocketKeepalivePropertyInfo o => o -> IO (AttrGetType SocketKeepalivePropertyInfo) # attrSet :: (AttrBaseTypeConstraint SocketKeepalivePropertyInfo o, AttrSetTypeConstraint SocketKeepalivePropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint SocketKeepalivePropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint SocketKeepalivePropertyInfo o, AttrSetTypeConstraint SocketKeepalivePropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint SocketKeepalivePropertyInfo o, AttrTransferTypeConstraint SocketKeepalivePropertyInfo b) => Proxy o -> b -> IO (AttrTransferType SocketKeepalivePropertyInfo) # | |||||||||||||||||||||||||||||||||
type AttrAllowedOps SocketKeepalivePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrBaseTypeConstraint SocketKeepalivePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrGetType SocketKeepalivePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrLabel SocketKeepalivePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrOrigin SocketKeepalivePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrSetTypeConstraint SocketKeepalivePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferType SocketKeepalivePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferTypeConstraint SocketKeepalivePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket |
constructSocketKeepalive :: (IsSocket o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “keepalive
” property. This is rarely needed directly, but it is used by new
.
getSocketKeepalive :: (MonadIO m, IsSocket o) => o -> m Bool Source #
Get the value of the “keepalive
” property.
When overloading is enabled, this is equivalent to
get
socket #keepalive
setSocketKeepalive :: (MonadIO m, IsSocket o) => o -> Bool -> m () Source #
Set the value of the “keepalive
” property.
When overloading is enabled, this is equivalent to
set
socket [ #keepalive:=
value ]
socketKeepalive :: AttrLabelProxy "keepalive" Source #
listenBacklog
The number of outstanding connections in the listen queue.
Since: 2.22
data SocketListenBacklogPropertyInfo Source #
Instances
AttrInfo SocketListenBacklogPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket Associated Types
Methods attrGet :: AttrBaseTypeConstraint SocketListenBacklogPropertyInfo o => o -> IO (AttrGetType SocketListenBacklogPropertyInfo) # attrSet :: (AttrBaseTypeConstraint SocketListenBacklogPropertyInfo o, AttrSetTypeConstraint SocketListenBacklogPropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint SocketListenBacklogPropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint SocketListenBacklogPropertyInfo o, AttrSetTypeConstraint SocketListenBacklogPropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint SocketListenBacklogPropertyInfo o, AttrTransferTypeConstraint SocketListenBacklogPropertyInfo b) => Proxy o -> b -> IO (AttrTransferType SocketListenBacklogPropertyInfo) # | |||||||||||||||||||||||||||||||||
type AttrAllowedOps SocketListenBacklogPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrBaseTypeConstraint SocketListenBacklogPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrGetType SocketListenBacklogPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrLabel SocketListenBacklogPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrOrigin SocketListenBacklogPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrSetTypeConstraint SocketListenBacklogPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferType SocketListenBacklogPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferTypeConstraint SocketListenBacklogPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket |
constructSocketListenBacklog :: (IsSocket o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “listen-backlog
” property. This is rarely needed directly, but it is used by new
.
getSocketListenBacklog :: (MonadIO m, IsSocket o) => o -> m Int32 Source #
Get the value of the “listen-backlog
” property.
When overloading is enabled, this is equivalent to
get
socket #listenBacklog
setSocketListenBacklog :: (MonadIO m, IsSocket o) => o -> Int32 -> m () Source #
Set the value of the “listen-backlog
” property.
When overloading is enabled, this is equivalent to
set
socket [ #listenBacklog:=
value ]
socketListenBacklog :: AttrLabelProxy "listenBacklog" Source #
localAddress
The local address the socket is bound to.
Since: 2.22
data SocketLocalAddressPropertyInfo Source #
Instances
AttrInfo SocketLocalAddressPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket Associated Types
Methods attrGet :: AttrBaseTypeConstraint SocketLocalAddressPropertyInfo o => o -> IO (AttrGetType SocketLocalAddressPropertyInfo) # attrSet :: (AttrBaseTypeConstraint SocketLocalAddressPropertyInfo o, AttrSetTypeConstraint SocketLocalAddressPropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint SocketLocalAddressPropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint SocketLocalAddressPropertyInfo o, AttrSetTypeConstraint SocketLocalAddressPropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint SocketLocalAddressPropertyInfo o, AttrTransferTypeConstraint SocketLocalAddressPropertyInfo b) => Proxy o -> b -> IO (AttrTransferType SocketLocalAddressPropertyInfo) # | |||||||||||||||||||||||||||||||||
type AttrAllowedOps SocketLocalAddressPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrBaseTypeConstraint SocketLocalAddressPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrGetType SocketLocalAddressPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrLabel SocketLocalAddressPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrOrigin SocketLocalAddressPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrSetTypeConstraint SocketLocalAddressPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferType SocketLocalAddressPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferTypeConstraint SocketLocalAddressPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket |
getSocketLocalAddress :: (MonadIO m, IsSocket o) => o -> m (Maybe SocketAddress) Source #
Get the value of the “local-address
” property.
When overloading is enabled, this is equivalent to
get
socket #localAddress
socketLocalAddress :: AttrLabelProxy "localAddress" Source #
multicastLoopback
Whether outgoing multicast packets loop back to the local host.
Since: 2.32
data SocketMulticastLoopbackPropertyInfo Source #
Instances
AttrInfo SocketMulticastLoopbackPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket Associated Types
Methods attrGet :: AttrBaseTypeConstraint SocketMulticastLoopbackPropertyInfo o => o -> IO (AttrGetType SocketMulticastLoopbackPropertyInfo) # attrSet :: (AttrBaseTypeConstraint SocketMulticastLoopbackPropertyInfo o, AttrSetTypeConstraint SocketMulticastLoopbackPropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint SocketMulticastLoopbackPropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint SocketMulticastLoopbackPropertyInfo o, AttrSetTypeConstraint SocketMulticastLoopbackPropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint SocketMulticastLoopbackPropertyInfo o, AttrTransferTypeConstraint SocketMulticastLoopbackPropertyInfo b) => Proxy o -> b -> IO (AttrTransferType SocketMulticastLoopbackPropertyInfo) # | |||||||||||||||||||||||||||||||||
type AttrAllowedOps SocketMulticastLoopbackPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrBaseTypeConstraint SocketMulticastLoopbackPropertyInfo Source # | |||||||||||||||||||||||||||||||||
type AttrGetType SocketMulticastLoopbackPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrLabel SocketMulticastLoopbackPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrOrigin SocketMulticastLoopbackPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrSetTypeConstraint SocketMulticastLoopbackPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferType SocketMulticastLoopbackPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferTypeConstraint SocketMulticastLoopbackPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket |
constructSocketMulticastLoopback :: (IsSocket o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “multicast-loopback
” property. This is rarely needed directly, but it is used by new
.
getSocketMulticastLoopback :: (MonadIO m, IsSocket o) => o -> m Bool Source #
Get the value of the “multicast-loopback
” property.
When overloading is enabled, this is equivalent to
get
socket #multicastLoopback
setSocketMulticastLoopback :: (MonadIO m, IsSocket o) => o -> Bool -> m () Source #
Set the value of the “multicast-loopback
” property.
When overloading is enabled, this is equivalent to
set
socket [ #multicastLoopback:=
value ]
socketMulticastLoopback :: AttrLabelProxy "multicastLoopback" Source #
multicastTtl
Time-to-live out outgoing multicast packets
Since: 2.32
data SocketMulticastTtlPropertyInfo Source #
Instances
AttrInfo SocketMulticastTtlPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket Associated Types
Methods attrGet :: AttrBaseTypeConstraint SocketMulticastTtlPropertyInfo o => o -> IO (AttrGetType SocketMulticastTtlPropertyInfo) # attrSet :: (AttrBaseTypeConstraint SocketMulticastTtlPropertyInfo o, AttrSetTypeConstraint SocketMulticastTtlPropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint SocketMulticastTtlPropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint SocketMulticastTtlPropertyInfo o, AttrSetTypeConstraint SocketMulticastTtlPropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint SocketMulticastTtlPropertyInfo o, AttrTransferTypeConstraint SocketMulticastTtlPropertyInfo b) => Proxy o -> b -> IO (AttrTransferType SocketMulticastTtlPropertyInfo) # | |||||||||||||||||||||||||||||||||
type AttrAllowedOps SocketMulticastTtlPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrBaseTypeConstraint SocketMulticastTtlPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrGetType SocketMulticastTtlPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrLabel SocketMulticastTtlPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrOrigin SocketMulticastTtlPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrSetTypeConstraint SocketMulticastTtlPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferType SocketMulticastTtlPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferTypeConstraint SocketMulticastTtlPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket |
constructSocketMulticastTtl :: (IsSocket o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “multicast-ttl
” property. This is rarely needed directly, but it is used by new
.
getSocketMulticastTtl :: (MonadIO m, IsSocket o) => o -> m Word32 Source #
Get the value of the “multicast-ttl
” property.
When overloading is enabled, this is equivalent to
get
socket #multicastTtl
setSocketMulticastTtl :: (MonadIO m, IsSocket o) => o -> Word32 -> m () Source #
Set the value of the “multicast-ttl
” property.
When overloading is enabled, this is equivalent to
set
socket [ #multicastTtl:=
value ]
socketMulticastTtl :: AttrLabelProxy "multicastTtl" Source #
protocol
The ID of the protocol to use, or -1
for unknown.
Since: 2.22
data SocketProtocolPropertyInfo Source #
Instances
AttrInfo SocketProtocolPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket Associated Types
Methods attrGet :: AttrBaseTypeConstraint SocketProtocolPropertyInfo o => o -> IO (AttrGetType SocketProtocolPropertyInfo) # attrSet :: (AttrBaseTypeConstraint SocketProtocolPropertyInfo o, AttrSetTypeConstraint SocketProtocolPropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint SocketProtocolPropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint SocketProtocolPropertyInfo o, AttrSetTypeConstraint SocketProtocolPropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint SocketProtocolPropertyInfo o, AttrTransferTypeConstraint SocketProtocolPropertyInfo b) => Proxy o -> b -> IO (AttrTransferType SocketProtocolPropertyInfo) # | |||||||||||||||||||||||||||||||||
type AttrAllowedOps SocketProtocolPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrBaseTypeConstraint SocketProtocolPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrGetType SocketProtocolPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrLabel SocketProtocolPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrOrigin SocketProtocolPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrSetTypeConstraint SocketProtocolPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferType SocketProtocolPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferTypeConstraint SocketProtocolPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket |
constructSocketProtocol :: (IsSocket o, MonadIO m) => SocketProtocol -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “protocol
” property. This is rarely needed directly, but it is used by new
.
getSocketProtocol :: (MonadIO m, IsSocket o) => o -> m SocketProtocol Source #
Get the value of the “protocol
” property.
When overloading is enabled, this is equivalent to
get
socket #protocol
socketProtocol :: AttrLabelProxy "protocol" Source #
remoteAddress
The remote address the socket is connected to.
Since: 2.22
data SocketRemoteAddressPropertyInfo Source #
Instances
AttrInfo SocketRemoteAddressPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket Associated Types
Methods attrGet :: AttrBaseTypeConstraint SocketRemoteAddressPropertyInfo o => o -> IO (AttrGetType SocketRemoteAddressPropertyInfo) # attrSet :: (AttrBaseTypeConstraint SocketRemoteAddressPropertyInfo o, AttrSetTypeConstraint SocketRemoteAddressPropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint SocketRemoteAddressPropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint SocketRemoteAddressPropertyInfo o, AttrSetTypeConstraint SocketRemoteAddressPropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint SocketRemoteAddressPropertyInfo o, AttrTransferTypeConstraint SocketRemoteAddressPropertyInfo b) => Proxy o -> b -> IO (AttrTransferType SocketRemoteAddressPropertyInfo) # | |||||||||||||||||||||||||||||||||
type AttrAllowedOps SocketRemoteAddressPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrBaseTypeConstraint SocketRemoteAddressPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrGetType SocketRemoteAddressPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrLabel SocketRemoteAddressPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrOrigin SocketRemoteAddressPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrSetTypeConstraint SocketRemoteAddressPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferType SocketRemoteAddressPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferTypeConstraint SocketRemoteAddressPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket |
getSocketRemoteAddress :: (MonadIO m, IsSocket o) => o -> m (Maybe SocketAddress) Source #
Get the value of the “remote-address
” property.
When overloading is enabled, this is equivalent to
get
socket #remoteAddress
socketRemoteAddress :: AttrLabelProxy "remoteAddress" Source #
timeout
The timeout in seconds on socket I/O
Since: 2.26
data SocketTimeoutPropertyInfo Source #
Instances
AttrInfo SocketTimeoutPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket Associated Types
Methods attrGet :: AttrBaseTypeConstraint SocketTimeoutPropertyInfo o => o -> IO (AttrGetType SocketTimeoutPropertyInfo) # attrSet :: (AttrBaseTypeConstraint SocketTimeoutPropertyInfo o, AttrSetTypeConstraint SocketTimeoutPropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint SocketTimeoutPropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint SocketTimeoutPropertyInfo o, AttrSetTypeConstraint SocketTimeoutPropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint SocketTimeoutPropertyInfo o, AttrTransferTypeConstraint SocketTimeoutPropertyInfo b) => Proxy o -> b -> IO (AttrTransferType SocketTimeoutPropertyInfo) # | |||||||||||||||||||||||||||||||||
type AttrAllowedOps SocketTimeoutPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrBaseTypeConstraint SocketTimeoutPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrGetType SocketTimeoutPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrLabel SocketTimeoutPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrOrigin SocketTimeoutPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrSetTypeConstraint SocketTimeoutPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferType SocketTimeoutPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferTypeConstraint SocketTimeoutPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket |
constructSocketTimeout :: (IsSocket o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “timeout
” property. This is rarely needed directly, but it is used by new
.
getSocketTimeout :: (MonadIO m, IsSocket o) => o -> m Word32 Source #
Get the value of the “timeout
” property.
When overloading is enabled, this is equivalent to
get
socket #timeout
setSocketTimeout :: (MonadIO m, IsSocket o) => o -> Word32 -> m () Source #
Set the value of the “timeout
” property.
When overloading is enabled, this is equivalent to
set
socket [ #timeout:=
value ]
socketTimeout :: AttrLabelProxy "timeout" Source #
ttl
Time-to-live for outgoing unicast packets
Since: 2.32
data SocketTtlPropertyInfo Source #
Instances
AttrInfo SocketTtlPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket Associated Types
Methods attrGet :: AttrBaseTypeConstraint SocketTtlPropertyInfo o => o -> IO (AttrGetType SocketTtlPropertyInfo) # attrSet :: (AttrBaseTypeConstraint SocketTtlPropertyInfo o, AttrSetTypeConstraint SocketTtlPropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint SocketTtlPropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint SocketTtlPropertyInfo o, AttrSetTypeConstraint SocketTtlPropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint SocketTtlPropertyInfo o, AttrTransferTypeConstraint SocketTtlPropertyInfo b) => Proxy o -> b -> IO (AttrTransferType SocketTtlPropertyInfo) # | |||||||||||||||||||||||||||||||||
type AttrAllowedOps SocketTtlPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrBaseTypeConstraint SocketTtlPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrGetType SocketTtlPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrLabel SocketTtlPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrOrigin SocketTtlPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrSetTypeConstraint SocketTtlPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferType SocketTtlPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferTypeConstraint SocketTtlPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket |
constructSocketTtl :: (IsSocket o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “ttl
” property. This is rarely needed directly, but it is used by new
.
getSocketTtl :: (MonadIO m, IsSocket o) => o -> m Word32 Source #
Get the value of the “ttl
” property.
When overloading is enabled, this is equivalent to
get
socket #ttl
setSocketTtl :: (MonadIO m, IsSocket o) => o -> Word32 -> m () Source #
Set the value of the “ttl
” property.
When overloading is enabled, this is equivalent to
set
socket [ #ttl:=
value ]
socketTtl :: AttrLabelProxy "ttl" Source #
type
The socket’s type.
Since: 2.22
data SocketTypePropertyInfo Source #
Instances
AttrInfo SocketTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket Associated Types
Methods attrGet :: AttrBaseTypeConstraint SocketTypePropertyInfo o => o -> IO (AttrGetType SocketTypePropertyInfo) # attrSet :: (AttrBaseTypeConstraint SocketTypePropertyInfo o, AttrSetTypeConstraint SocketTypePropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint SocketTypePropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint SocketTypePropertyInfo o, AttrSetTypeConstraint SocketTypePropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint SocketTypePropertyInfo o, AttrTransferTypeConstraint SocketTypePropertyInfo b) => Proxy o -> b -> IO (AttrTransferType SocketTypePropertyInfo) # | |||||||||||||||||||||||||||||||||
type AttrAllowedOps SocketTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrBaseTypeConstraint SocketTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrGetType SocketTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrLabel SocketTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrOrigin SocketTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrSetTypeConstraint SocketTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferType SocketTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket | |||||||||||||||||||||||||||||||||
type AttrTransferTypeConstraint SocketTypePropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Socket |
constructSocketType :: (IsSocket o, MonadIO m) => SocketType -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “type
” property. This is rarely needed directly, but it is used by new
.
getSocketType :: (MonadIO m, IsSocket o) => o -> m SocketType Source #
Get the value of the “type
” property.
When overloading is enabled, this is equivalent to
get
socket #type
socketType :: AttrLabelProxy "type" Source #