Foxtable(狐表)用户栏目专家坐堂 → 【求助】OpenQQ 登录问题


  共有27人关注过本帖树形打印复制链接

主题:【求助】OpenQQ 登录问题

帅哥哟,离线,有人找我吗?
王小风
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:53 积分:562 威望:0 精华:0 注册:2021/9/2 16:35:00
【求助】OpenQQ 登录问题  发帖心情 Post By:2025/4/23 18:12:00 [只看该作者]

图片点击可在新窗口打开查看 按照模板文件搬过来的代码 也提示登录失败
服务器代码:QQServer.ServerIp = e.Form.Controls("TextBox1").Value '指定IP地址
QQServer.ServerPort = e.Form.Controls("TextBox2").Value '指定端口
QQServer.HeartbeatInterval = e.Form.Controls("TextBox3").Value '指定心跳时间
QQServer.HeartbeatTimeout = e.Form.Controls("TextBox4").Value '指定心跳超时时间
QQserver.Buildin = True '一定要加上这个,表示使用内置身份验证
QQServer.Start() '启动QQServer

登录代码:
If QQClient.Ready Then
    MessageBox.show("QQClient已经启动,请先关闭", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
    Return
End If
QQClient.ServerIP = e.Form.Controls("TextBox1").Value '指定服务器IP地址
QQClient.ServerPort = e.Form.Controls("TextBox2").Value '指定服务器端口
QQClient.UserName = ""
QQClient.Password = ""
If QQClient.Start() = True  Then'如果登录成功
    e.Form.Controls("b-ltck").Enabled = True
    Dim msg As String = "恭喜,OpenQQ登录成功!"
    If QQClient.ServerMessage > "" Then '如果服务器返回了欢迎信息
        msg = msg & QQClient.ServerMessage
    End If
    ConfigBar.Items("OpenQQ").SmallImage = GetImage("online.ico")
    popMessage(msg, "提示", PopiconEnum.Infomation, 5)
Else '如果登录失败,显示服务器返回错误信息
    e.Form.Controls("b-ltck").Enabled = False
    PopMessage("QQClient登录失败,原因:" & vbcrlf & QQClient.ServerMessage, "提示", PopiconEnum.Error, 5)
End If
网络监控代码:
If e.User Is Nothing Then
    Return
Else
    e.Success = True
End If
Dim dr As DataRow
dr = DataTables("用户").Find("姓名 = '" & e.User.Name & "'")
If dr IsNot Nothing Then
    Dim nms As New List(Of String)
    nms.AddRange(dr("好友").Split(","))
    For Each u As UserInfo In Users
        If u.Name <> e.User.Name Then
            If nms.Contains(u.Name) OrElse nms.Contains("[" & u.Group & "]") Then
                If u.Group > "" Then
                    e.Buddies.Add(u.Group & "." & u.Name)
                Else
                    e.Buddies.Add(u.Name)
                End If
            End If
        End If
    Next
Else
    For Each u As UserInfo In Users
        If u.Name <> e.User.Name Then
            If u.Group > "" Then
                e.Buddies.Add(u.Group & "." & u.Name)
            Else
                e.Buddies.Add(u.Name)
            End If
        End If
    Next
End If

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:113573 积分:578372 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2025/4/24 8:42:00 [只看该作者]

单机测试,还是跨网络测试?ServerIp填的是什么地址?

不要使用开发者和管理员账户测试

 回到顶部
帅哥哟,离线,有人找我吗?
王小风
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:53 积分:562 威望:0 精华:0 注册:2021/9/2 16:35:00
  发帖心情 Post By:2025/4/24 13:46:00 [只看该作者]

单机本地测试 服务器地址127.0.0.1  端口52177
用普通用户打开服务,和登录都是一样的结果!


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:113573 积分:578372 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2025/4/24 13:51:00 [只看该作者]

服务端UserLogging只保留下面代码测试有没有问题

网络监控代码:
If e.User Is Nothing Then
    Return
Else
    e.Success = True
End If

另外注意服务端和客户端需要分开2个项目

 回到顶部