Skip to content

Commit d13472a

Browse files
authored
UDP test server
Added a UDP test server to troubleshoot UDP connection issues
1 parent fb86489 commit d13472a

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,52 @@ Probely's support team.
130130
Alternatively, the agent can use an HTTP proxy to connect to Probely if the `HTTP_PROXY` environment variable is set on the `docker-compose.yml` file.
131131
While the agent can use an HTTP proxy or a direct TCP connection to Probely, this can cause poor network performance. For more information, see this article about the [TCP Meltdown](https://web.archive.org/web/20220103191127/http://sites.inka.de/bigred/devel/tcp-tcp.html) problem. We **strongly recommend** that you allow the agent to connect to `54.247.135.113`, `44.212.186.140`, and `54.253.10.194` on `UDP` port `443`.
132132
133+
### Unsuccessful UDP connection issues
134+
If the Agent is not connecting through UDP, and you are getting the log:
135+
136+
```
137+
...
138+
Connecting to Probely (via UDP) ... unsuccessful
139+
Configuring fallback TCP tunnel ... done
140+
Connecting to Probely (via TCP) ... done
141+
...
142+
```
143+
144+
It's because the UDP connection is being blocked.
145+
146+
To confirm if nothing is blocking the UDP connections, you can set up a UDP server using the following script **outside your network** to "echo" the received messages:
147+
148+
```python
149+
import socket
150+
151+
def udp_server(host='0.0.0.0', port=12345):
152+
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
153+
sock.bind((host, port))
154+
print(f"UDP server listening on {host}:{port}")
155+
156+
while True:
157+
data, client_address = sock.recvfrom(1024)
158+
print(f"Received message from {client_address}: {data.decode()}")
159+
response = f"Received your message: {data.decode()}"
160+
sock.sendto(response.encode(), client_address)
161+
162+
if __name__ == "__main__":
163+
udp_server()
164+
```
165+
166+
And test it with:
167+
168+
```shell
169+
$ echo "AAAAAA" | nc xx.xx.xx.xx 12345
170+
Received your message: AAAAAA
171+
```
172+
173+
You should test large messages:
174+
175+
```shell
176+
$ python3 -c 'print("A"*2000)' | nc xx.xx.xx.xx 12345
177+
Received your message: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA....
178+
```
133179
134180
# Building from source
135181

0 commit comments

Comments
 (0)