首页 > 解决方案 > 无法从现有 UDP 套接字绑定 UDT 套接字

问题描述

我正在为 UDT 库使用 rust wrapper ( udt-0.1.0 ),但我无法将 UDT 套接字绑定到现有的 UDP 套接字。

use std::net::UdpSocket;
use udt::*; // 0.2.0

fn main() {
    let udp_sock = UdpSocket::bind("127.0.0.1:8000").unwrap();
    let udt_sock = UdtSocket::new(SocketFamily::AFInet, SocketType::Stream).unwrap();
    udt_sock.bind_from(udp_sock).unwrap();
}

每当我尝试执行此代码时,都会遇到错误:

5003: Operation not supported: Bad parameters: Bad file descriptor.

标签: socketsrustnetwork-programmingudphole-punching

解决方案


推荐阅读