Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How-to? Connect to remote pc over LAN connection ?

How-to? Connect to remote pc over LAN connection ?

Scheduled Pinned Locked Moved C#
sysadminhelptutorialquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Adel83k
    wrote on last edited by
    #1

    plz help me out here dods.., i wanna example a simple one please to connect to other pc in the local area network and perform operation like loging off or killing process that will help me alot ADEL K Khalil

    E S S 3 Replies Last reply
    0
    • A Adel83k

      plz help me out here dods.., i wanna example a simple one please to connect to other pc in the local area network and perform operation like loging off or killing process that will help me alot ADEL K Khalil

      E Offline
      E Offline
      eggie5
      wrote on last edited by
      #2

      Uh, basically your going to need... 1. A server app for the remote computer 2. A client app for you And that's it. The server will sit on the remote computer listening for for requests on the specified port. This is done with the TcpListener.[^] Then client app will be on your compter and will use the TcpClient class[^] and take the ip address of the server app and the port in the Connect method. It's pretty simple. Uh, I think the best way is to look at examples here and on msdn. And, also for the server functions like logging off you can use the API ExitWindowsEx[^]. Uh.... and there are .net classes like Process for killing apps and stuff... yeah.... SO here's the overview. Make the server and the client. Start the server on the remote machine and start it listening for incoming connections. then start your client then say... You have some preconfigurations in your server code that says if the incoming message says "logoff" then your server will run the ExitWindowsEx method. So, with your client enter the name/ip of your remote computer and then send "logoff" to the server then your remote comp. will logoff. there. done. I hope my links work. Remember, theres lots or examples here and msdn. /\ |_ E X E GG

      A 1 Reply Last reply
      0
      • A Adel83k

        plz help me out here dods.., i wanna example a simple one please to connect to other pc in the local area network and perform operation like loging off or killing process that will help me alot ADEL K Khalil

        S Offline
        S Offline
        Steven Campbell
        wrote on last edited by
        #3

        RealVNC.COM (free, easy, works).

        1 Reply Last reply
        0
        • A Adel83k

          plz help me out here dods.., i wanna example a simple one please to connect to other pc in the local area network and perform operation like loging off or killing process that will help me alot ADEL K Khalil

          S Offline
          S Offline
          sides_dale
          wrote on last edited by
          #4

          This easiest way is to use the WSH and vbscript. Here is a quick sample 'strCompName = "." 'This is for the local host strCompName = "computer name" ' ip address may work as well Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strCompName & "\root\cimv2") Set colProcessList = objWMIService.ExecQuery _ ("Select * from Win32_Process Where Name = 'Notepad.exe'") For Each objProcess in colProcessList objProcess.Terminate() Next Save the code above as stopnotepad.vbs and call it from the commandline with cscript stopnotepad.vbs You may want to check out the MSDN section on scripting, particullarly the scripting clinic and scripting guys.

          1 Reply Last reply
          0
          • E eggie5

            Uh, basically your going to need... 1. A server app for the remote computer 2. A client app for you And that's it. The server will sit on the remote computer listening for for requests on the specified port. This is done with the TcpListener.[^] Then client app will be on your compter and will use the TcpClient class[^] and take the ip address of the server app and the port in the Connect method. It's pretty simple. Uh, I think the best way is to look at examples here and on msdn. And, also for the server functions like logging off you can use the API ExitWindowsEx[^]. Uh.... and there are .net classes like Process for killing apps and stuff... yeah.... SO here's the overview. Make the server and the client. Start the server on the remote machine and start it listening for incoming connections. then start your client then say... You have some preconfigurations in your server code that says if the incoming message says "logoff" then your server will run the ExitWindowsEx method. So, with your client enter the name/ip of your remote computer and then send "logoff" to the server then your remote comp. will logoff. there. done. I hope my links work. Remember, theres lots or examples here and msdn. /\ |_ E X E GG

            A Offline
            A Offline
            Adel83k
            wrote on last edited by
            #5

            thanks that help me alot ADEL K Khalil

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups