UDP is a connectionless protocol, so the socket function connect seems to have no meaning for UDP, but this is not the case.
A socket has several properties, including protocol, local address/port, destination address/port.
For UDP, the socket function establishes a socket; the bind function specifies the local address/port (including ADDR_ANY, which is compatible with all local network interfaces); connect can be used to indicate the destination address/port;
Generally speaking, after the UDP client establishes the socket, it will directly send data using the sendto function. The destination address/port needs to be specified in the parameters of the sendto function. If a UDP client first uses the connect function to specify the destination address/port after setting up the socket, then the send function can also be used to send data. Because the send function already knows the address/port of the other party, this information can also be obtained by using getsockname.
After the UDP client establishes the socket, it will send data directly using the sendto function. It also implies an operation, that is, before sending the data, UDP will first select a separate UDP port for the socket. Between 1024 and 5000), the socket is set to the bound state. If a UDP client first uses the bind function to indicate the local address/port after setting up the socket, it is also possible to force UDP to use the specified port to send data. (In fact, UDP doesn't matter the server and the client, the boundaries here are blurred.)
The UDP server can also use connect. As mentioned above, connect can be used to indicate the destination address/port; this will result in The server only accepts requests from a specific host.
KVM: Kernel-based Virtual Machine is an open source virtualization solution based on the Linux kerne
U disk operating method under Linux and operating methods under windows system are still somewhat d
When reading apue, the shared storage area is not used for instance. For this reason, I wrote a smal
Windows CE is an embedded operating system developed by Microsoft that can be used in a variety of e
/var/lib/mysql/mysql.sock connection failed
Centos install apache detailed tutorial
How to build a Linux firewall using netfilter/iptables
How to find recently modified files in Linux
Mkimage” command not found – U-Boot images will not be bui
Nagios nrpe process can't start problem
VMware Workstation Installs Linux System
Three steps to teach you how to create a Linux flash drive
Twelve reasons why you have to look forward to Ubuntu 10.10
Analysis of WindowsAzure and the multi-faceted nature of the cloud
Windows7 English version of the language to change the language for Simplified Chinese skills
Win7 how to save all webpage images with one click
What should I do if the Win7 start menu is missing?
iSCSI target configuration [Windows storage device using linux]
How to delete recent game history in win7
Where is the win10 ie browser? Win10 open IE11 browser method
Explanation of the meaning of some common processes in Vista system
Win10/win8 system to play LOL screen character card, frame loss how to solve