Results 1 to 6 of 6

Thread: mulyple conexions desktop viewer

Hybrid View

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2017
    Posts
    3

    Exclamation 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
    -----------------------------------

  2. #2
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    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.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2017
    Posts
    3

    Re: mulyple conexions desktop viewer

    Quote Originally Posted by Niya View Post
    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.

  4. #4
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    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.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  5. #5

    Thread Starter
    New Member
    Join Date
    Dec 2017
    Posts
    3

    Re: mulyple conexions desktop viewer

    Quote Originally Posted by Niya View Post
    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.

  6. #6
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: mulyple conexions desktop viewer

    Quote Originally Posted by cosmos89 View Post
    Yes i need this! you can do it realy importan please...
    somethink like that
    http://vb.net-informations.com/commu...rogramming.htm
    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.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width