lysS
V2EX  ›  问与答

向网络发送数据时的耗时,是 CPU 频率决定还是网卡的性能?

  •  
  •   lysS · May 12, 2021 · 846 views
    This topic created in 1921 days ago, the information mentioned may be changed or developed.

    Golang

    
    con, _:= net.DialUDP("udp", &net.UDPAddr{IP: nil, Port: 19986}, &net.UDPAddr{IP: net.ParseIP("3.3.3.3"), Port: 19986})
    
    
    for i := 0; i < 200; i++ {
    	a := time.Now()
    	if _, err = con.Write([]byte("sadfsas")); err != nil {
    		fmt.Println(err)
    		return
    	}
    	fmt.Println("耗时", time.Since(a))
    }
    
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2805 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 07:28 · PVG 15:28 · LAX 00:28 · JFK 03:28
    ♥ Do have faith in what you're doing.