1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/net/socket_udp_test.v

19 lines
368 B
V
Raw Normal View History

import net
fn start_socket_udp_server() {
bufsize := 1024
bytes := [1024]byte
s := net.socket_udp() or { panic(err) }
s.bind( 9876 ) or { panic(err) }
println('Waiting for udp packets:')
for {
res := s.crecv(bytes, bufsize)
if res < 0 { break }
print('Received $res bytes: ' + tos(bytes, res))
}
}
fn test_udp_server() {
// start_socket_udp_server()
}