⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 udp.sgml

📁 unix/linux general net toolkit
💻 SGML
字号:
<!-- ##### SECTION Title ##### -->UDP<!-- ##### SECTION Short_Description ##### -->UDP socket<!-- ##### SECTION Long_Description ##### --><para>This module provides support for UDP sockets.  UDP is an internetprotocol that transfers packets by best-effort delivery.  Packets maybe lost or arrive out-of-order.  Use TCP if your protocol requiresdata transfered reliably and in-order -- most do.</para><para>A UDP socket is represented by a #GUdpSocket structure.  To create a#GUdpSocket, call gnet_udp_socket_new(),gnet_udp_socket_new_with_port(), or gnet_udp_socket_new_full().</para><para>To send a packet, call gnet_udp_socket_send().  To receive a packet,call gnet_udp_socket_receive().  gnet_udp_socket_send() will block ifthe OS cannot buffer the packet immediately.gnet_udp_socket_receive() will block until there is a packet availableto receive.  Call gnet_udp_socket_has_packet() to determine whether apacket is available immediately.  A more elegant method is to get the#GIOChannel and add a read watch.  A callback will be called when apacket is available.  Note that a UDP socket's #GIOChannel is not anormal #GIOChannel -- it should not be written to or read fromdirectly.</para><para>Packets have a time-to-live (TTL) field.  This field is decrementedbefore a router forwards the packet.  If the TTL reaches zero, thepacket is dropped.  The TTL can be set by callinggnet_udp_socket_get_ttl().  The default value is sufficient for mostapplications.</para><!-- ##### SECTION See_Also ##### --><para></para><!-- ##### STRUCT GUdpSocket ##### --><para></para><!-- ##### FUNCTION gnet_udp_socket_new ##### --><para></para>@Returns: <!-- ##### FUNCTION gnet_udp_socket_new_with_port ##### --><para></para>@port: @Returns: <!-- ##### FUNCTION gnet_udp_socket_new_full ##### --><para></para>@iface: @port: @Returns: <!-- ##### FUNCTION gnet_udp_socket_delete ##### --><para></para>@socket: <!-- # Unused Parameters # -->@s: <!-- ##### FUNCTION gnet_udp_socket_ref ##### --><para></para>@socket: <!-- # Unused Parameters # -->@s: <!-- ##### FUNCTION gnet_udp_socket_unref ##### --><para></para>@socket: <!-- # Unused Parameters # -->@s: <!-- ##### FUNCTION gnet_udp_socket_send ##### --><para></para>@socket: @buffer: @length: @dst: @Returns: <!-- # Unused Parameters # -->@s: @data: <!-- ##### FUNCTION gnet_udp_socket_receive ##### --><para></para>@socket: @buffer: @length: @src: @Returns: <!-- # Unused Parameters # -->@s: @data: <!-- ##### FUNCTION gnet_udp_socket_has_packet ##### --><para></para>@socket: @Returns: <!-- # Unused Parameters # -->@s: <!-- ##### FUNCTION gnet_udp_socket_get_io_channel ##### --><para></para>@socket: @Returns: <!-- ##### FUNCTION gnet_udp_socket_get_local_inetaddr ##### --><para></para>@socket: @Returns: <!-- ##### FUNCTION gnet_udp_socket_get_ttl ##### --><para></para>@socket: @Returns: <!-- # Unused Parameters # -->@us: <!-- ##### FUNCTION gnet_udp_socket_set_ttl ##### --><para></para>@socket: @ttl: @Returns: <!-- # Unused Parameters # -->@us: @val: 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -