远程桌面和聊天 [英] Remote Desktop and Chatting

查看:170
本文介绍了远程桌面和聊天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了像团队查看器这样的程序

hi guys i had created program like team viewer

但是问题是tcp侦听器获取了客户端的图片,并且

but the problem is that the tcp listener get the pic of client and

尝试将其转换为字符串

因此导致程序崩溃

Sub UpdateList(ByVal str As String, ByVal relay As Boolean)
        Dim values As Object
        On Error Resume Next
        For Each value In values
            Dim t As Type = value.GetType()
            If InvokeRequired Then
                If t.Equals(GetType(String)) Then
                    Invoke(New _cUpdate(AddressOf UpdateList), str, relay)
                Else
                    MsgBox("we did it")
                End If
            Else
                TextBox1.AppendText(str & vbNewLine)
                ' if relay we will send a string
                If relay Then send(str)
            End If
        Next
    End Sub
'=========================================================
  Sub send(ByVal str As String)
        For x As Integer = 0 To clientList.Count - 1
            Try
                clientList(x).Send(str)
            Catch ex As Exception
                clientList.RemoveAt(x)
            End Try
        Next
    End Sub
'=======================================================
    Sub AcceptClient(ByVal ar As IAsyncResult)
        pClient = New ClassforClient(ss.EndAcceptTcpClient(ar))
        AddHandler (pClient.getMessage), AddressOf MessageReceived
        AddHandler (pClient.clientLogout), AddressOf ClientExited
        clientList.Add(pClient)
        ss.BeginAcceptTcpClient(New AsyncCallback(AddressOf AcceptClient), ss)

    End Sub
'======================================================
    Sub MessageReceived(ByVal str As String)
        UpdateList(str, True)
    End Sub
    Sub ClientExited(ByVal client As ClassforClient)
        clientList.Remove(client)
        UpdateList("Client Exited!", True)
    End Sub
'======================================================


这会发生什么

当我开始共享

推荐答案

除非将所有消息全部编码为字符串,否则不能将所有消息都视为字符串.

You can't treat all messages as strings unless you've encoded them all as strings in the first place.

我们看不到图像最初是如何编码然后再传输到远程主机的,但是如果您想将所有消息作为字符串传输,则需要使用Base64编码之类的东西将图像字节转换为字符串.

We can't see how the image was initially encoded and then transmitted to the remote host, but if you want to transfer all messages as strings then you need to use something like Base64 encoding to convert the image bytes into a string.

最终,这是一个非常复杂的应用程序,与原始ASCII文本字符串相比,您可能需要更强大的消息传递机制.

At the end of the day, this is a very complex application to build and you will likely need a more robust messaging mechanism than raw strings of ASCII text.


这篇关于远程桌面和聊天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆