TCP vs UDP vs ICMP
如前所述,对于所有类型的socket,并不是都有同样的成员函数。下面的表格列出了3个socket中存在的成员函数:
名称 | TCP | UDP | ICMP |
---|---|---|---|
async_read_some | Yes | - | - |
async_receive_from | - | Yes | Yes |
async_write_some | Yes | - | - |
async_send_to | - | Yes | Yes |
read_some | Yes | - | - |
receive_rom | - | Yes | Yes |
write_some | Yes | - | - |
send_to | - | Yes | Yes |
杂项函数
还有其他的一些函数用户处理连接或者输入/输出:
- local_endpoint():返回socket的本地连接地址。
- remote_endpoint():返回socket连接到的远程地址。
- native_handle():返回原始socket的句柄。只在你确实需