<blockquote>
<p>Please help me understand what does it actually mean to say connection oriented implementation wise?</p>
</blockquote>
<p>这意味着TCP协议依赖于一个开放的连接来工作。换句话说,<em>必须是一个开放的连接,通过这个连接,通过socket发送的消息包可以通过这个连接进行发送。在</p>
<blockquote>
<p>And how does the connect(), listen() and accept() APIs help achieve this?</p>
</blockquote>
<p>我从未使用过这个Python套接字库,但我认为我对套接字的基本知识足以解释这一点。<code>connect</code>方法用于打开我在前面的回答中提到的这个非常相同的连接。服务器使用另外两种方法来接收通过这个打开的连接从客户端发送的消息。在</p>
<blockquote>
<p>Similarly, for the UDP counterparts, the resources suggest that the UDP echo client does not use any connect() and nor does the UDP echo server use any listen() or accept(). This helps it achieve connectionless behavior. Please help me understand how exactly ?</p>
</blockquote>
<p>您可能知道UDP协议与TCP协议不同,它不依赖于开放连接来工作。这意味着消息包被“原子”地发送(彼此独立),这将使前面的方法变得无用。正如您在问题中链接的文档所述:</p>
<p><em>由于没有连接,服务器本身不需要监听和接受连接。它只需要使用bind()将其套接字与端口相关联,然后等待单个消息。</em></p>
<p>这意味着使用UDP进行套接字通信的服务器所要做的就是注册一个端口,该端口将从客户端发送并通过<code>recvfrom</code>方法接收套接字消息。客户机也使用此方法从服务器接收消息。在</p>
<blockquote>
<p>Even to be able to send data to a remote server, will it still not need a socket endpoint to actually send the data and also receive data when the server sends it back ?</p>
</blockquote>
<p>API可能没有公开一个方法来做这个客户端,因为客户机动态地选择端口并阻止其他程序成为该端口中的服务器,或者至少他们应该这样做。在</p>