-
Dec 20th, 2017, 01:04 PM
#1
Thread Starter
New Member
mulyple conexions desktop viewer
I want a previous form table of id of the server conected. next(with right click option call remote desk viewer. this is the simple cod:
client:
Imports System.IO
Imports System.Net
Imports System.Net.Sockets
Imports System.Threading
Imports System.Drawing
Imports System.Runtime.Serialization.Formatters.Binary
Dim client As New TcpClient
Dim nstream As NetworkStream
Public Function Desktop() As Image
Dim bounds As Rectangle = Nothing
Dim screenshot As System.Drawing.Bitmap = Nothing
Dim graph As Graphics = Nothing
bounds = Screen.PrimaryScreen.Bounds
screenshot = New Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
graph = Graphics.FromImage(screenshot)
graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
Return screenshot
End Function
Private Sub SendImage()
Dim bf As New BinaryFormatter
nstream = client.GetStream
bf.Serialize(nstream, Desktop())
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Try
client.Connect("127.0.0.1", 8085)
Catch ex As Exception
' MsgBox("Failed to connect...")
End Try
If client.Connected Then
SendImage()
End If
End Sub
-------------------------------------------------------------------------------------
server:
Imports System.IO
Imports System.Net
Imports System.Net.Sockets
Imports System.Threading
Imports System.Drawing
Imports System.Runtime.Serialization.Formatters.Binary
Dim client As New TcpClient
Dim server As New TcpListener(8085)
Dim nstream As NetworkStream
Dim listening As New Thread(AddressOf Listen)
Dim getImage As New Thread(AddressOf receiveImage)
Private Sub receiveImage()
Dim bf As New BinaryFormatter
While client.Connected = True
nstream = client.GetStream
picturebox1.Image = bf.Deserialize(nstream)
End While
End Sub
Private Sub Listen()
While client.Connected = False
server.Start()
client = server.AcceptTcpClient
End While
getImage.Start()
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
listening.Start()
end sub
font: http://dota.eurobattle.net/la/forum/...?topic=90829.0
thanks
-----------------------------------
-
Dec 20th, 2017, 05:29 PM
#2
Re: mulyple conexions desktop viewer
Your question isn't clear. What does "previous form table of id" mean? Also, is that code working?
One more thing, I did a complete program like this some years ago. You can check it out here if you want. It might give you some ideas.
-
Dec 20th, 2017, 06:35 PM
#3
Thread Starter
New Member
Re: mulyple conexions desktop viewer
Originally Posted by Niya
Your question isn't clear. What does "previous form table of id" mean? Also, is that code working?
One more thing, I did a complete program like this some years ago. You can check it out here if you want. It might give you some ideas.
I want a previous form with a listbox with the username of the server as id
this code works but is only for one conection...i want a listbox with diferent servers conections. then with right click get the desktop
Last edited by cosmos89; Dec 20th, 2017 at 06:39 PM.
-
Dec 20th, 2017, 07:36 PM
#4
Re: mulyple conexions desktop viewer
If you want multiple connections then you have to refactor the server code to handle that. It's not just a matter of simply putting a ListBox and changing a couple lines of code. You will need to use some kind of array or list to contain all the different connections. Then you'd need to give each of them their own thread to communicate. You'd need to design a basic protocol so you can give each client a name to put in your ListBox on the server. That code you have needs a major overhaul to implement these things. You can use it as a base but it will take a fair bit of work.
-
Dec 20th, 2017, 08:00 PM
#5
Thread Starter
New Member
Re: mulyple conexions desktop viewer
Originally Posted by Niya
If you want multiple connections then you have to refactor the server code to handle that. It's not just a matter of simply putting a ListBox and changing a couple lines of code. You will need to use some kind of array or list to contain all the different connections. Then you'd need to give each of them their own thread to communicate. You'd need to design a basic protocol so you can give each client a name to put in your ListBox on the server. That code you have needs a major overhaul to implement these things. You can use it as a base but it will take a fair bit of work.
Yes i need this! you can do it realy importan please...
somethink like that
http://vb.net-informations.com/commu...rogramming.htm
Last edited by cosmos89; Dec 20th, 2017 at 08:03 PM.
-
Dec 20th, 2017, 10:25 PM
#6
Re: mulyple conexions desktop viewer
Originally Posted by cosmos89
I can't do this for you, I'm sorry. It will take a bit of work and I don't have that kind of time to commit right now, especially when I already wrote an app like this. The code to that app is freely available and I even linked it in an earlier post.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|