none
How to Open a Form or manage interface in another screen by ip address ?

All replies

  •  Have you tried searching the internet for some examples and common ways of communicating with another computer?  Try looking through some of the links in the google search link below.

    comunicate with another computer using IP address vb.net

     If you type something similar in the Search box at the top of this forum`s main page,  you will find a bunch more examples and info on this too.


    If you say it can`t be done then i`ll try it

    Tuesday, March 14, 2017 10:42 PM
  • There are two ways to send the messages from one computer to another over an IP network, a thousand-and-one ways to control the remote host, and a billion combinations of ways to implement each piece of the major functionality required.

    Which combination of answers should we give you?

    This kind of application requires a clear definition of everything you are going to control on the remote computer along with the details of the messages which will need to be exchanged in order to do so.  You can't really begin to define a communication protocol for your program until you've defined the work that needs to be done and generally how you'll do it.

    I could give you an example which sets the back color of a control on the remote form and it would be quite short. But it might not extend well when you then try to make the program change the text of the label. So I could give a slightly more complex example which sets (most) any property of (most) any control on the remote form.  OK great, but then you want to be able to open another new form on the remote host, or take some other action, and the protocol must be redesigned again to accommodate this.  Then you decide to take screen shots or move the mouse and you need more and more functionality in your protocol design and the code which handles it.

    Each of those changes could lead to a large change in the way the code is implemented. 

    Essentially you need to decide whether to use the TCP or UDP transport, and then come up with a message format which efficiently encapsulates all of the possible commands and their parameters which you will send to the remote host (along with any status messages you may receive in reply).  The message is typically a class object with properties to describe the message and whose property values can be written directly into, or read from, a binary stream.

    Sending and receiving generic data is covered in the MSDN documentation for the TcpClient and UdpClient objects.  The data you will send and receive will be the byte-stream versions of your message objects.  All of the other details are up to you and depend on what you need to accomplish.

    Note that this is a peer-to-peer system, which is what you asked for.  Another way to accomplish the ultimate goal would be with a client-server system where a third system on the internet acts as the intermediary for the two clients.  This is actually a better configuration for usage in the public Internet because it eliminates need for special firewall configurations for the computer acting as the server host and allows for easier implementation of a SSL secured connection.


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Tuesday, March 14, 2017 11:43 PM
    Moderator
  • thank you IronRazerz

    but Shi does not have apparent when I search in the engine google !

    Wednesday, March 15, 2017 6:21 PM
  • As solution could you give your IP address, then could everybody try to do it for you. 

    However, you should not do that I want to show that then any code given here can be used for malicious reasons. 

    That is not that you are intended to do that, but it can be done with that code. 

    You won't believe it, but forum rules say we should not do that. 

    Few chance you find this on Internet either, it is called hacking. 


    Success
    Cor


    Wednesday, March 15, 2017 6:30 PM
  • thank you Cor Ligthert  , I want connect between 2 PC and show alarm from pc1 to pc2 by change color

    Wednesday, April 05, 2017 7:12 PM
  • Since you haven't provided any additional detail about how you want to connect, what other kinds of operations you want to perform, or even where the remote host is located, here is a simple example of sending a UDP broadcast message to all machines on your local network.  Run this program on two or more separate computers on the same network, press the button on one of them, and all of them will have the label turn red.

    Public Class Form1
        Friend WithEvents Label1 As New Label With {.AutoSize = True, .Text = "The Alarm Label", .BackColor = Color.DarkGreen, .ForeColor = Color.WhiteSmoke}
        Friend WithEvents Button1 As New Button With {.AutoSize = True, .Text = "Send Alarm Message", .Top = Label1.Top + Label1.Height + 4}
    
        Private client As New Net.Sockets.UdpClient(59001)
        Private broadcastEndpoint As New Net.IPEndPoint(Net.IPAddress.Broadcast, 59001)
        Private isRunning As Boolean
    
        Private Async Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Controls.Add(Label1)
            Controls.Add(Button1)
    
            client.EnableBroadcast = True
    
            isRunning = True
            Do While isRunning
                Dim result = Await client.ReceiveAsync()
                Dim message = System.Text.Encoding.ASCII.GetString(result.Buffer)
                If message = "Set Label Red" Then
                    Label1.BackColor = Color.Red
                End If
            Loop
        End Sub
    
        Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
            isRunning = False
        End Sub
    
        Private Async Sub Button1_Client(sender As Object, e As EventArgs) Handles Button1.Click
            Dim buffer = System.Text.Encoding.ASCII.GetBytes("Set Label Red")
            Await client.SendAsync(buffer, buffer.Length, broadcastEndpoint)
        End Sub
    End Class
    

    This is just one of the billions of combinations of ways you might do this.  If this isn't exactly what you wanted then please explain more about your ultimate goal for this program.


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Thursday, April 06, 2017 12:07 PM
    Moderator
  • Reed,

    I think we have another idea of going through a door. 

    You suggest to hire somebody who opens that for you from the inner-side, of course can that be done. I had the idea the OP suggested to do it using a key (the IP address).

    :-)


    Success
    Cor

    Friday, April 07, 2017 12:36 PM
  • Reed,

    I think we have another idea of going through a door. 

    You suggest to hire somebody who opens that for you from the inner-side, of course can that be done. I had the idea the OP suggested to do it using a key (the IP address).

    :-)


    Success
    Cor


    Oh I agree, a directed transmission would be better; one typically avoids actual data transmission over broadcast and uses it only for discovery purposes.  But without any additional detail, a simple broadcast example was the easiest thing to demonstrate.

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Friday, April 07, 2017 1:06 PM
    Moderator
  • thanks Reed Kimble , I use local network in company , how to add ip address in your code
     and where Client code and server code
    • Edited by srajmuneer Friday, May 05, 2017 9:16 PM
    Friday, May 05, 2017 8:56 PM
  • thanks Reed Kimble , I use local network in company , how to add ip address in your code
     and where Client code and server code

    Instead of using the broadcast address you would replace it with a specific IP address.  Then you would need two different copies of the program, one with each address (or make the address something the user can enter from a textbox).  There is no "client" or "server" since this is peer-to-peer... the program is both a client and a server depending on how it is being used.

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Saturday, May 06, 2017 12:02 PM
    Moderator