(create)
(create arg)
(create port local-addr)
A constructor for datagram sockets. This function my take 0, 1, or two args.
DatagramSocketImpl
class,
Creates an unbound datagram socket with the specified DatagramSocketImpl
.
If the argument is an integer, it is interpreted as a port, in which
case, datagram socket will be constructed and bound to the specified port
on the local host machine. If the argument is an instance of
SocketAddress
, the constructor creates a datagram socket, bound to the
specified local socket address.InetAddress
.A constructor for datagram sockets. This function my take 0, 1, or two args. * 0-arity: Constructs a datagram socket and binds it to any available port on the local host machine. * 1-arity: If the argument is an instance of the `DatagramSocketImpl` class, Creates an unbound datagram socket with the specified `DatagramSocketImpl`. If the argument is an integer, it is interpreted as a port, in which case, datagram socket will be constructed and bound to the specified port on the local host machine. If the argument is an instance of `SocketAddress`, the constructor creates a datagram socket, bound to the specified local socket address. * 2-arity: Creates a datagram socket, bound to the specified port and local `InetAddress`.
(so-timeout! this timeout)
Enable/disable SO_TIMEOUT
with the specified timeout, in milliseconds.
Enable/disable `SO_TIMEOUT` with the specified timeout, in milliseconds.
(traffic-class! this class-int)
Sets traffic class or type-of-service octet in the IP datagram header for
datagrams sent from this DatagramSocket
.
Sets traffic class or type-of-service octet in the IP datagram header for datagrams sent from this `DatagramSocket`.
(receive-buffer-size this)
Get value of the SO_RCVBUF option for this
DatagramSocket, that is the buffer size used by the platform for input on this
DatagramSocket`.
Get value of the `SO_RCVBUF option for this `DatagramSocket`, that is the buffer size used by the platform for input on this `DatagramSocket`.
(bind this addr)
Binds this DatagramSocket
to a specific address and port.
Binds this `DatagramSocket` to a specific address and port.
(local-address this)
Gets the local address to which the socket is bound.
Gets the local address to which the socket is bound.
(reuse-address this)
Tests if SO_REUSEADDR
is enabled.
Tests if `SO_REUSEADDR` is enabled.
(local-socket-address this)
Returns the address of the endpoint this socket is bound to.
Returns the address of the endpoint this socket is bound to.
(receive-buffer-size! this size)
Sets the SO_RCVBUF
option to the specified value for this
DatagramSocket
.
Sets the `SO_RCVBUF` option to the specified value for this `DatagramSocket`.
(bound? this)
Returns the binding state of the socket.
Returns the binding state of the socket.
(send-buffer-size this)
Get value of the SO_SNDBUF
option for this DatagramSocket
, that is the
buffer size used by the platform for output on this DatagramSocket
.
Get value of the `SO_SNDBUF` option for this `DatagramSocket`, that is the buffer size used by the platform for output on this `DatagramSocket`.
(send-buffer-size! this size)
Sets the SO_SNDBUF
option to the specified value for this
DatagramSocket
.
Sets the `SO_SNDBUF` option to the specified value for this `DatagramSocket`.
(remote-socket-address this)
Returns the address of the endpoint this socket is connected to, or null if it is unconnected.
Returns the address of the endpoint this socket is connected to, or null if it is unconnected.
(connected? this)
Returns the connection state of the socket.
Returns the connection state of the socket.
(local-port this)
Returns the port number on the local host to which this socket is bound.
Returns the port number on the local host to which this socket is bound.
(connect this addr)
(connect this addr port)
For the 1-arity function, connects this socket to a remote socket address
(IP address + port number; must be an instance or subclass of
SocketAddress
). For the 2-arity function, connects the socket to a remote
address amd port for this socket (the address must be an instance or
subclass of InetAddress
).
For the 1-arity function, connects this socket to a remote socket address (IP address + port number; must be an instance or subclass of `SocketAddress`). For the 2-arity function, connects the socket to a remote address amd port for this socket (the address must be an instance or subclass of `InetAddress`).
(channel this)
Returns the unique DatagramChannel
object associated with this datagram
socket, if any.
Returns the unique `DatagramChannel` object associated with this datagram socket, if any.
(receive this)
(receive this packet)
Receives a datagram packet from this socket. Additionally, the Clojure
wrapper allows you to pass the packet size instead of the packet itself. If
this option is exercised, a packet of the indicated size will be created and
returned. Another Clojure wrapper convenience, the 1-arity version of this
function, will use the default packet size DEFAULT_PACKET_SIZE
and create
a packet under the covers with that size.
Receives a datagram packet from this socket. Additionally, the Clojure wrapper allows you to pass the packet size instead of the packet itself. If this option is exercised, a packet of the indicated size will be created and returned. Another Clojure wrapper convenience, the 1-arity version of this function, will use the default packet size `DEFAULT_PACKET_SIZE` and create a packet under the covers with that size.
(traffic-class this)
Gets traffic class or type-of-service in the IP datagram header for
packets sent from this DatagramSocket
.
Gets traffic class or type-of-service in the IP datagram header for packets sent from this `DatagramSocket`.
(port this)
Returns the port number to which this socket is connected.
Returns the port number to which this socket is connected.
(close this)
Closes this datagram socket.
Closes this datagram socket.
(broadcast? this)
Tests if SO_BROADCAST
is enabled.
Tests if `SO_BROADCAST` is enabled.
(closed? this)
Returns whether the socket is closed or not.
Returns whether the socket is closed or not.
(inet-address this)
Returns the address to which this socket is connected.
Returns the address to which this socket is connected.
(broadcast! this bool)
Enable/disable SO_BROADCAST
.
Enable/disable `SO_BROADCAST`.
(so-timeout this)
Retrieve setting for SO_TIMEOUT
.
Retrieve setting for `SO_TIMEOUT`.
(reuse-address! this bool)
Enable/disable the SO_REUSEADDR
socket option.
Enable/disable the `SO_REUSEADDR` socket option.
(send this packet)
Sends a datagram packet from this socket.
Sends a datagram packet from this socket.
(disconnect this)
Disconnects the socket.
Disconnects the socket.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close