-
-
Couldn't load subscription status.
- Fork 5.6k
Description
Today I discovered a very strange issue, the UDP/8000 port is not accessible. There are no issues with the security group and listener, but after tinkering for a while, I had to raise a ticket with the cloud service provider for further investigation.
During the process of raising the ticket, I realized that troubleshooting the accessibility of UDP ports is a more complicated issue compared to checking if TCP port 22 is accessible. Unlike TCP, there is no commonly used UDP server to test the connectivity, making it difficult to investigate.
In the end, it was discovered that the UDP ports below 8000 were blocked by the company. There were no issues when using 4G or home WiFi, but changing to UDP port 18000 resolved the problem. This indicates that:
- To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
I found some simple UDP servers and clients that can be run on my own server, and then tested them on the client side.
OBS WHIP
NC
Start a UDP server:
nc -l -k -u 8000Start a UDP client:
echo 'Hello' |nc -u 127.0.0.1 8000If success, you should see the message in the UDP server.
IPERF
Start a UDP server:
iperf -s -u -p 8000Start a UDP client:
iperf -c 127.0.0.1 -u -b 10g -p 8000If success, you can see the report of bandwidth.
Go
Code snippet: Gist
Start the server:
go run server.go
Execute the command to check if the listening is normal:
netstat -lnptu | grep 8000
# udp 0 0 0.0.0.0:8000 0.0.0.0:* 1016220/server
Execute the nc command, send the message Hello to the server, and then press Enter:
nc -u 127.0.0.1 8000
# Hello
# Pong: Hello
Run the client on the local machine:
go run client.go
The result should be normal:
Ping: Hello, UDP server
Pong: Hello, UDP serverRun the client, specifying the remote server:
go run client.go 101.20.7.11
Below is the code to prevent everyone from accessing the gist. Other languages are welcome to contribute.
server.go
/*
Usage:
go run server.go
See https://gist.github.com/winlinvip/e8665ba888e2fd489ccd5a449fadfa73
See https://stackoverflow.com/a/70576851/17679565
*/
package main
import (
"fmt"
"net"
"os"
"strconv"
)
func main() {
serverPort := 8000
if len(os.Args) > 1 {
if v,err := strconv.Atoi(os.Args[1]); err != nil {
fmt.Printf("Invalid port %v, err %v", os.Args[1], err)
os.Exit(-1)
} else {
serverPort = v
}
}
addr := net.UDPAddr{
Port: serverPort,
IP: net.ParseIP("0.0.0.0"),
}
server, err := net.ListenUDP("udp", &addr)
if err != nil {
fmt.Printf("Listen err %v\n", err)
os.Exit(-1)
}
fmt.Printf("Listen at %v\n", addr.String())
for {
p := make([]byte, 1024)
nn, raddr, err := server.ReadFromUDP(p)
if err != nil {
fmt.Printf("Read err %v", err)
continue
}
msg := p[:nn]
fmt.Printf("Received %v %s\n", raddr, msg)
go func(conn *net.UDPConn, raddr *net.UDPAddr, msg []byte) {
_, err := conn.WriteToUDP([]byte(fmt.Sprintf("Pong: %s", msg)), raddr)
if err != nil {
fmt.Printf("Response err %v", err)
}
}(server, raddr, msg)
}
}clieng.go
/*
Usage:
go run client.go
go run client.go 101.201.77.240
See https://gist.github.com/winlinvip/e8665ba888e2fd489ccd5a449fadfa73
See https://stackoverflow.com/a/70576851/17679565
*/
package main
import (
"fmt"
"net"
"os"
"strings"
)
func main() {
serverEP := "127.0.0.1"
if len(os.Args) > 1 {
serverEP = os.Args[1]
}
if !strings.Contains(serverEP, ":") {
serverEP = fmt.Sprintf("%v:8000", serverEP)
}
conn, err := net.Dial("udp", serverEP)
if err != nil {
fmt.Printf("Dial err %v", err)
os.Exit(-1)
}
defer conn.Close()
msg := "Hello, UDP server"
fmt.Printf("Ping: %v\n", msg)
if _, err = conn.Write([]byte(msg)); err != nil {
fmt.Printf("Write err %v", err)
os.Exit(-1)
}
p := make([]byte, 1024)
nn, err := conn.Read(p)
if err != nil {
fmt.Printf("Read err %v\n", err)
os.Exit(-1)
}
fmt.Printf("%v\n", string(p[:nn]))
}
TRANS_BY_GPT3
Activity
[-]WebRTC: UDP/8000 check tool for WebRTC 检测UDP/8000是否可以访问的工具[/-][+]WebRTC: UDP/8000 check tool 检测UDP/8000是否可以访问的工具[/+]fandong1993 commentedon Jan 22, 2022
Hello, author,
I have also confirmed that it is an issue with the upd8000 port. I would like to ask how you modified the udp port. I changed the host port to 18000, but the container's port remained as 8000. As a result, the rtc cannot play properly, and the playback address, whether it is webrtc://host/live/livestream or webrtc://host:18000/live/livestream, keeps spinning.
Thank you.
TRANS_BY_GPT3winlinvip commentedon Jan 23, 2022
Currently, the host's port and the container's port are not supported to be different. You need to change the listening port of the container as well. Please refer to the WIKI for specific instructions.
TRANS_BY_GPT3fandong1993 commentedon Jan 23, 2022
Hmm, I understand now. The ones inside the container also need to be modified...
Just as I opened my computer, I suddenly saw your reply. Thank you.
Wishing you a happy new year in advance.
TRANS_BY_GPT3[-]WebRTC: UDP/8000 check tool 检测UDP/8000是否可以访问的工具[/-][+]WebRTC: UDP/8000 check tool' is a tool used to check whether UDP/8000 can be accessed.[/+][-]WebRTC: UDP/8000 check tool' is a tool used to check whether UDP/8000 can be accessed.[/-][+]WebRTC: A small tool for testing WebRTC UDP connectivity on port 8000.[/+][-]WebRTC: A small tool for testing WebRTC UDP connectivity on port 8000.[/-][+]WebRTC: A small tool for testing UDP connectivity on UDP 8000.[/+]