You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
977 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#!/bin/bash
# 测试Web服务器脚本
echo "========================================="
echo " 测试Web聊天服务器"
echo "========================================="
echo ""
# 检查编译
if [ ! -d "bin" ] || [ ! -f "bin/server/WebSocketServer.class" ]; then
echo "🔨 先编译项目..."
./compile_web.sh
if [ $? -ne 0 ]; then
echo "❌ 编译失败"
exit 1
fi
fi
echo "🚀 启动Web服务器调试模式..."
echo ""
echo "📱 访问地址: http://localhost:8080"
echo "🌐 局域网访问: http://$(hostname -I | awk '{print $1}'):8080"
echo ""
echo "💡 测试步骤:"
echo " 1. 在浏览器打开上述地址"
echo " 2. 输入用户名登录"
echo " 3. 打开多个浏览器标签页测试多用户聊天"
echo " 4. 查看下方服务器日志输出"
echo ""
echo "按 Ctrl+C 停止服务器"
echo "========================================="
echo ""
cd bin
java -cp ".:../lib/gson-2.10.1.jar" server.WebSocketServer