github.com/wangyougui/gf/v2@v2.6.5/net/gudp/gudp_z_example_test.go (about) 1 // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/wangyougui/gf. 6 7 package gudp_test 8 9 import ( 10 "fmt" 11 12 "github.com/wangyougui/gf/v2/net/gudp" 13 ) 14 15 func ExampleGetFreePort() { 16 fmt.Println(gudp.GetFreePort()) 17 18 // May Output: 19 // 57429 <nil> 20 } 21 22 func ExampleGetFreePorts() { 23 fmt.Println(gudp.GetFreePorts(2)) 24 25 // May Output: 26 // [57743 57744] <nil> 27 }