mirror of
https://github.com/fatedier/frp.git
synced 2025-12-13 19:45:43 +00:00
start refactoring
This commit is contained in:
27
utils/net/udp_test.go
Normal file
27
utils/net/udp_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package net
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestA(t *testing.T) {
|
||||
l, err := ListenUDP("0.0.0.0", 9000)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
for {
|
||||
c, _ := l.Accept()
|
||||
go func() {
|
||||
for {
|
||||
buf := make([]byte, 1450)
|
||||
n, err := c.Read(buf)
|
||||
if err != nil {
|
||||
fmt.Println(buf[:n])
|
||||
}
|
||||
|
||||
c.Write(buf[:n])
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user