Initial commit
Dieser Commit ist enthalten in:
115
test_activity_connection.py
Normale Datei
115
test_activity_connection.py
Normale Datei
@ -0,0 +1,115 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test-Skript für Activity Server Verbindung
|
||||
"""
|
||||
|
||||
import requests
|
||||
import socket
|
||||
import time
|
||||
from urllib.parse import urlparse
|
||||
|
||||
def test_connection(server_url="http://91.99.192.14:3001"):
|
||||
print(f"Teste Verbindung zu: {server_url}")
|
||||
print("-" * 50)
|
||||
|
||||
# Parse URL
|
||||
parsed = urlparse(server_url)
|
||||
host = parsed.hostname
|
||||
port = parsed.port or 80
|
||||
|
||||
# 1. DNS/IP Test
|
||||
print(f"1. Teste DNS-Auflösung für {host}...")
|
||||
try:
|
||||
ip = socket.gethostbyname(host)
|
||||
print(f" ✓ IP-Adresse: {ip}")
|
||||
except socket.gaierror as e:
|
||||
print(f" ✗ DNS-Fehler: {e}")
|
||||
return
|
||||
|
||||
# 2. Port Test
|
||||
print(f"\n2. Teste TCP-Verbindung zu {host}:{port}...")
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.settimeout(5)
|
||||
try:
|
||||
result = sock.connect_ex((host, port))
|
||||
if result == 0:
|
||||
print(f" ✓ Port {port} ist erreichbar")
|
||||
else:
|
||||
print(f" ✗ Port {port} ist nicht erreichbar (Fehlercode: {result})")
|
||||
print(" Mögliche Ursachen:")
|
||||
print(" - Firewall blockiert die Verbindung")
|
||||
print(" - Server läuft nicht auf diesem Port")
|
||||
print(" - Netzwerk-Routing-Problem")
|
||||
return
|
||||
except Exception as e:
|
||||
print(f" ✗ Verbindungsfehler: {e}")
|
||||
return
|
||||
finally:
|
||||
sock.close()
|
||||
|
||||
# 3. HTTP Test
|
||||
print(f"\n3. Teste HTTP-Verbindung...")
|
||||
try:
|
||||
response = requests.get(f"{server_url}/health", timeout=5)
|
||||
print(f" ✓ HTTP Status: {response.status_code}")
|
||||
if response.status_code == 200:
|
||||
print(" ✓ Server antwortet korrekt")
|
||||
print(f" Response: {response.text[:100]}...")
|
||||
else:
|
||||
print(f" ⚠ Server antwortet mit Status {response.status_code}")
|
||||
except requests.exceptions.ConnectionError as e:
|
||||
print(f" ✗ Verbindungsfehler: {e}")
|
||||
print(" Mögliche Ursachen:")
|
||||
print(" - Server ist nicht erreichbar")
|
||||
print(" - Firewall blockiert HTTP/HTTPS")
|
||||
except requests.exceptions.Timeout:
|
||||
print(" ✗ Timeout - Server antwortet nicht rechtzeitig")
|
||||
except Exception as e:
|
||||
print(f" ✗ Unerwarteter Fehler: {e}")
|
||||
|
||||
# 4. Socket.IO Test
|
||||
print(f"\n4. Teste Socket.IO Verbindung...")
|
||||
try:
|
||||
# Socket.IO initial handshake
|
||||
response = requests.get(
|
||||
f"{server_url}/socket.io/?transport=polling&EIO=4",
|
||||
timeout=5
|
||||
)
|
||||
print(f" Status: {response.status_code}")
|
||||
if response.status_code == 200:
|
||||
print(" ✓ Socket.IO Endpoint erreichbar")
|
||||
else:
|
||||
print(f" ✗ Socket.IO antwortet mit Status {response.status_code}")
|
||||
except Exception as e:
|
||||
print(f" ✗ Socket.IO Fehler: {e}")
|
||||
|
||||
# 5. Traceroute simulation (simplified)
|
||||
print(f"\n5. Netzwerk-Route (vereinfacht)...")
|
||||
import subprocess
|
||||
try:
|
||||
if socket.gethostname().lower().startswith("win"):
|
||||
cmd = ["tracert", "-h", "10", host]
|
||||
else:
|
||||
cmd = ["traceroute", "-m", "10", host]
|
||||
|
||||
result = subprocess.run(cmd, capture_output=True, text=True, timeout=10)
|
||||
print(result.stdout[:500])
|
||||
except:
|
||||
print(" Traceroute nicht verfügbar")
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Test mit dem Activity Server
|
||||
test_connection("http://91.99.192.14:3001")
|
||||
|
||||
print("\n" + "=" * 50)
|
||||
print("DIAGNOSE:")
|
||||
print("=" * 50)
|
||||
print("\nWenn Port erreichbar aber HTTP nicht funktioniert:")
|
||||
print("- Prüfen Sie, ob der Activity Server korrekt läuft")
|
||||
print("- Prüfen Sie die Server-Logs")
|
||||
print("- Stellen Sie sicher, dass es ein HTTP-Server ist (nicht HTTPS)")
|
||||
print("\nWenn Port nicht erreichbar:")
|
||||
print("- Windows Firewall prüfen")
|
||||
print("- Router/Netzwerk-Firewall prüfen")
|
||||
print("- VPN-Verbindung prüfen (falls erforderlich)")
|
||||
print("- Prüfen ob Sie im richtigen Netzwerk sind")
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren