Author
Mahamud Hasan
Wasif Islam
kishor datta gupta
we develop a software which perform basic PC controlling operations and complete remote access using C#. With our software we can establish a connection to any computer via the LAN in just a few seconds and remotely control this computer just as if you were sitting in front of it.
our software can able to do following tasks
- We can connect server pc and client pc.
- Maximum 5 clients can connect to the server.
- Server and client can transfer data with each other.
- Only server can tranfer file to the client.
- Server pc can shutdown, restart and logoff to the client pc.
- Using remote access server pc can see the desktop of the client.
- Server pc can browse client pc and install any kind of software.
- Server pc can access to the computer to be serviced and it can perform any action even if no-one is sitting in front of it.
Features:Simple implementation of a TCP client server relationship
When the server program is run, it will indicate at which IP it is running and the port it is listening to. Using Tcp listener server can listen its ip address and port. “Dns.GetHostByName(Dns.GetHostName()).AddressList[0];
” –Using this code we get the server ip address. At the same time a thread will be running. This thread will waiting for client connection.
Now run the client program and write down the server ip address. Then press the “Connect” button and it establishes a connection with the server.
When a connection is established the server will display the client IP address from where it has accepted the connection and client will ask for the string which is to be transmitted to the server. The server on reciept of the string will display it, send an acknowledgement which will be recieved by the client.
The client can be either run from the same machine as the server or from a different machine. If run from a different machine then a network connection should exist between the machines running the server and client programs.
When any client connect with the server then from the server display a combobox named “Client IP List” contains all client IP.
When connection is established between server and client then server and client can transfer message with each other.
When server send message then client recieve this message. At the same time client can send message to the server from the Message textbox.Then server also recieve data from the client. Server can transfer file to the client. Using Networkstream server can transfer file. When we press File Transfer button then a file dialoug box is open. Then select a file and send it.
There are controll operations that the server will perform to the client. If server want to shut down the client pc then server can select the shut down button and activate it. Then client pc will shut down. Server can do three operations if it want. These are Shutdown , restart and log off.
We use Remote Desktop a great deal. Using remote access server can browse the client PC. All kind of operation can be performed by the server when remote is active,
For that we get a help from a codeproject article . Thanks to it we make a very effective remote access,
We will be using AxMSTSCLib
an ActiveX component in our program to connect to the remote computer. It’s not that hard to build a remote desktop application in .NET. Microsoft has a “Microsoft RDP client control” ActiveX control that we will be using in our application.We will start by creating a Windows application in the Visual Studio IDE. Add a reference to “Microsoft Terminal Services Control Type Library” from the COM tab. This will add MSTSCLib.dll to the project.
To add MSTSC to the toolbox, right click the toolbox and select “Choose Items…”. Now add “Microsoft Terminal Services control from the COM tab.
Drag the newly added control from toolbox to the form.
Here is how we write the Connect button click event.
rdp.Server = txtServer.Text;
rdp.UserName = txtUserName.Text;
IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx();
secured.ClearTextPassword = txtPassword.Text;
rdp.Connect();
Now assign the properties (Server
, UserName
) of RDP control with the textbox values. Here’s how easy it is to login to remote machine. However there is one catch, there is no direct method in RDP control through which you can pass the username and password to login to the remote desktop. Due to security reasons, you have to implement an interface (IMsTscNonScriptable)
to cast it separately.
IMsTscNonScriptable secured = IMsTscNonScriptable)rdp.GetOcx();
secured.ClearTextPassword = txtPassword.Text;
To disconnect from the remote desktop session, we just need to call the Disconnect()
method.
Before disconnecting, we want to ensure that the connection is still available. We don’t want to disconnect if it is already disconnected.
if (rdp.Connected.ToString() == "1") rdp.Disconnect();
Though we have developed our software using the platform independent programming language C# but our software is not totally platform independent at all. Because our software only run in the .net framework version 3.5. But we are tried our best to do that. There are a few limitations in our software cause it can remotely connect to only one client pc at a time.
Full source code of this software is here
sir…. i want this software for my project submission….!!!!
plz help me…..
in the link, there is full source code, if there is any problem to understand . feel free to ask
thnx
Link is not working can you just mail me the code on himanshuverma23888@gmail.com
plz give me code on nhanntv113@gmail.com
Thank you very much, i want it to my project!
hello sir this link is not working plz send me correct code on my mail id abhay221@gmail.com
help me plz . i want this code that is way of my project . can you just mail me the code on nu_anp@hotmail.com.thank you very much
i can’t see your project coding . plz send to this mail id vinith59@gmail.com
thnx
Can you plz send me code on my mail ID harsh.varudkar@hotmail.com
plz send code to aruncraft@gmail.com, link is not working in this post
This file does not exist. Where I am download full source code…
Controlling PC And Remote Access via lan in c#
The link not working, can you send me the code please
me too sir… i can’t download the file in the given links…you can email the code in this address..thanjoenax@gmail.com…thank u so much…
Hi Kishor..
I am not able to download the source.. When i click on download link it is redirect to “http://www.multiupload.com/JTO85OTULI” site.. From here how to download ?
Please help
yes
sir,
i m trying to downlode ur project but not geting perfect link ,so plz sir give me the project link in my email id “ravisaaz@gmail.com”
hi can u plz send me the code to aruncraft@gmail.com
Sir,
I downloaded ur project.It’s brilliant work done by you.But i am facing one error as multiple clients get added into combobox then only the recently joined client can be contacted by server i.e if there are 2 pc’s joined then the later one i.e pc 2 is only interacted with server despite the selection of IP of Pc 1 in combobox.
Plz help me in this matter.
Sir,
I downloaded ur project.It’s brilliant work done by you.But i am facing one error as multiple clients get added into combobox then only the recently joined client can be contacted by server i.e if there are 2 pc’s joined then the later one i.e pc 2 is only interacted with server despite the selection of IP of Pc 1 in combobox.
Plz help me in this matter.
Thank you.
plz see below comment from mr Prashantha Achary.
thanks
Hi Shahzad ,
What you have to do is , every time whenever clients (PC) get connects you have to store the socket in collection (Arraylist / Hash table) . And also u have to remove the client from collection whenever it get disconnect. So at any point of time u can access the connected clients .
thank u very much.
Thanks for ur reply,i would be helpful if you could put some code.
Thanks …
With the help of Kishordgupta’s code, I changed the code . I am using Socket (using System.Net.Sockets;) instead of TCPClient . And I used asynchronous delegate for client connection , for data received , and for data disconnection..
So , if u provide ur email id , then i will send the souce code to u.
Respected sir can u email your project to me as the remote desktop isnt working
thank you sir
i justt wanted code to get list of ip’s9machines) that are connected in lan n just need to installed softare(remotely)…so plz help me lit bit m very confused after searching so many things..hope for positive reply sir…
sonijaymin@yahoo.com
Hi Here is the code,
Step 1 : Create class called ClientObject to hold the state of the client.
public class ClientObject
{
public IPAddress m_IPAddress = null;
public TcpClient m_tcpClient = null;
public ClientObject(TcpClient tcpClient)
{
m_tcpClient = tcpClient;
m_IPAddress = ((System.Net.IPEndPoint)(tcpClient.Client.RemoteEndPoint)).Address;
}
}
step 2: Create a hash table
// Hash table is used to keep track of sockets that are designed to //
// communicate with each connected client (identified by DID). It is //
// made a synchronized HashTable for thread safety //
public System.Collections.Hashtable m_objHashTable =
Hashtable.Synchronized(new System.Collections.Hashtable());
step 3: create a delegate to add clients to hash table asynchronously
public delegate void AddClientToCollection(ClientObject objClient);
Step 4: Create a lock object for accessing Hash table
public Object m_objHashTableLock = new object();
step 5: In performConnect method add below 2 lines of code after
tcpClient = myList.AcceptTcpClient(); this line
//Add these 2 line code
ClientObject objClient = new ClientObject(tcpClient);
this.Invoke(new AddClientToCollection(OnClientConnectedCallback));
step 6 : Finally add this method
// This call back is called whenever a client connects to the server
public void OnClientConnectedCallback(ClientObject objClient)
{
try
{
ClientObject objClientEntry = null;
lock (m_objHashTableLock)
{
// Add to the table only if client is already not present
if (m_objHashTable.Contains(objClient.m_IPAddress) == false)
{
// Add client to hash table – A NEW CONNECTION
m_objHashTable[objClient.m_IPAddress] = objClient;
}
// Now the control can come here for two reasons //
// 1. Correct socket/connection and a new packet has arrived //
// this is the case for most packets (normal operation). //
// 2. Reconnection had happened, old connection retained in //
// the server and this is the first packet from the //
// client with the communication happening with new //
// socket. //
else
{
objClientEntry =
(ClientObject)m_objHashTable[objClient.m_IPAddress];
// Now detect if it is case 1. //
// This can be accomplished by checking if the socket ID //
// in the hashtable (corresponding to the clientobject) //
// is same as what is received in this callback. //
if (objClientEntry.m_tcpClient ==
objClient.m_tcpClient)
{
// Do Nothing as this is the expected case when a //
// packet comes from a connected client //
}
// Now control comes here only if it is a reconnection!! //
// Why? because, there is a stale socket lying in the //
// hash table in the name of this client (from where the //
// packet is received) from a different socket id!, //cp
// hence it has to be properly handled. //
else
{
// Close the stale socket handle in hashtable
objClient.m_tcpClient.Close();
// Clear the entry in the hashtable for this DID
m_objHashTable.Remove(objClient.m_IPAddress);
// Release object assigned during connection
((IDisposable)objClientEntry).Dispose();
// Recognize this (client – recevied now) as the //
// valid connection and insert it to hashtable //
m_objHashTable[objClient.m_IPAddress] = objClient;
}
}
}
}
catch (Exception ex)
{
}
}
Hope you understand …. 🙂
THANKS A LOT, CAN I ADD THIS IN MY BLOG WITH UR NAME ?
AND CAN U SEND UR .CS FILE SO I ADD IT IN DOWNLOAD LINK ?
U REALLY DONE A EXCELLENT JOB. IDEA OF HASH TABLE IS REMARKABLE.
plzz send me source code of this project if u got it.. plzz plzzz help me plzzz……
email ID r.gupta2508@gmail.com
thankuuuu……….thankuuu
Thanks a lot Prashanth achary…
Really superb job….if possible for u can u plz mail me the updated copy of this project to mail address.
My mail id : yazee17@rediffmail.com
Also if possible please provide some guidance on following…
*I have picturebox on server machine for recieving & displaying client desktop.I want to do is display specific client desktop in specific picturebox but i m unable to do this.Plz help me.
Thank You.
Hi Shahzad,
In my application , I am not displaying client computer in picture box, instead i am showing in Tree view with Client Computer name and its IP adress. U can select one of the client from the tree view and send the command to client system from menu item.
Ok i am sending code to ur email id.
can u plz send me also, my mail id is kdgupa87@gmail.com
and can add this in my blog with ur name (plz send a profile address fb,linkedin, twitter)
Hi Kishor,
My server application is completely deferent than ur code. But functionality wise one and same. I am still trying improve the code as well as UI.
Any way i am sending the code to u.
Hope u will like that.
Thanks a lot Prashanth…
But i tried ur code its throwing an exception as soon as client connects to server in line below as parameter count mismatch.
The line is: this.Invoke(new AddClientToCollection(OnClientConnectedCallback));
what could be this exception about & how to deal with it.
Sorry Dude,
I hurry i have done the code for you without testing ,
Here is the solution.
Step1 : Create a instance of the delegate for which we have created for adding clients to the collection like this
//(Add this line after declaring the delegate )
AddClientToCollection objAddClientToCollection;
Step 2 : Initialize the delegate (inside the form1 method)
objAddClientToCollection =
new AddClientToCollection(OnClientConnectedCallback);
step 3 : Replace
this.BeginInvoke(new AddClientToCollection(OnClientConnectedCallback));
this line of code with
objAddClientToCollection.Invoke(objClient);
in performConnect method.
This will work…… 🙂
1)It works but my problem remains unsloved i.e when client get connected to server i am unable to contact earlier connected pc’s.when i select earlier connected IP from combobox.It only send message to last connected client.
2) I also recieved ur cybercafe code but when client connects it throws an exception as “Exception has been thrown by the target of an invocation.”
Plz help me solve out these 2 problems
plzz send me source code of this project if u got it.. plzz plzzz help me plzzz……
email ID gupta2508@gmail.com
thankuuuu
plzz send me source code of this project if u got it.. plzz plzzz help me plzzz……
email ID r.gupta2508@gmail.com
thankuuuu
sir can you pls send me a code pls? and the interface .. because i cannot download the source code in the site given .. if you can send it to me its a big favor for me .. tnx in advance .. i m very need this because I need for my case study .. tnx a lot ..
this is my email jettrussellsarmiento24@yahoo.com
plzz send me source code of this project if u got it.. plzz plzzz help me plzzz……
email ID r.gupta2508@gmail.com
thankuuuu….
Sir will u plz send me the code ?????
my email address is rosni.bd@gmail.com
A-W-E-S-O-M-E dada. I’ll obviously look on it from you. 😀
u r welcome
plzz send me source code of this project if u got it.. plzz plzzz help me plzzz……
email ID gupta2508@gmail.com
thankuuu
plzz send me source code of this project if u got it.. plzz plzzz help me plzzz……
email ID r.gupta2508@gmail.com
thankuu
Really great.
Thanks a lot for sharing this.
thnx
plzz send me source code of this project if u got it.. plzz plzzz help me plzzz……
email ID gupta2508@gmail.com
মাথা নষ্ট হইছে … খুব ভাল … চালায়ে যাও
ভাই, এই প্রজেক্টের অর্ধেকের বেশি কাজ আপনার ই করা । আর আপনি কন মাথা নষ্ট?
Hello sir,
I unable to download project.
please help me.
http://www.megaupload.com/?d=NB4H5JBE
try this link plz
Does not download this link
please help me.
i am unable to get remote access using this code in client ip text box i write the ip of client but in user name and password box what i have to write?
comp. name or user name?
need help!
comp. name
hi sir
hope you fine…
sir this link is not working kindly mail me this code as soon as posible.
my id is humaramuqdes_rana@yahoo.com
thanku.
an early reply for help is required!
Thanks sir. I downloaded this. In this remote machine access not work. Sir I want to show the shared file of server on client and vice versa as like regular file sharing and also want to set the permission for the server share folders. Means if server shares the folder “abc” then client should the access the read only. if client needs other permission then he will request to server. After permitting the server permission he can use this file. How can i do this? Please help me.
Hi,
The program was very good but i can’t use Remote Access!!!
i am unable to get remote access.
i entered ip of client in Client Ip textbox but in user name and password box what i have to write?
If you have complete documentation with more details for this application,I would be grateful if you can upload it.
Thanks a lot
You have to enter Client PC’s username and his PC’s password…To know the username of client PC, click to the start menu of that pc and know the Administrator name and Password…To remote login you have to know the client PC’s IP,administrator name and password.
I hope it will work.
You have to Enter Client PC’s administrator name in the user name field and password to password box.To remote login you have to know Client PC’s IP, Administrator name and administration password.
Hope this will work.
You have to enter Client PC’s Administrator name and his pc’s password.
To remote login you have to know Client PC’s IP, administrator name and administrator password.
Hope this will help you…
Thanks
But it really doesn’t work!
Does anyone already tried this program?
For more Help plz specify the error u r getting n also mention what ur entering in the textboxes….Also try this out….
1) Verify there is full connectivity present i.e. LAN connection.
2 ) U have to enter username of windows account & its password of client or network PC.If network pc has no password assigned u have to assign it & then try it out….
3) If it still won’t work verify that remote connection must be enable from system properties i.e. to verify just follow this…
a) Right Click “My Computer —> Properties”.
b) Select “Remote” Tab…
c) In that just verify that “Allow users to connect remotely to this computer” is checked…..if not make it checked..
Try out if any prob….contact
Dear Zeeshan
I did all these things but can not be performed.
And when I press the Connect button several times tandem with the face I get the following error:
(error connecting to remote desktop. error Hresult E_fail…) ???!!!
Thanks for the tips.
Hello
This is really amazing!
I am looking for a long time.
Why the remote control does not work?
can You Test again this application and if it’s running, upload this project again???
Thanks
while viewing client pc..the client pc get locked..how to avoid this
hi, great work can i ask will this work if i try to access another computer desktop via internet, if not can you guide me how it will be possible. Any help appreciated.
Thanks and great work
Controlling pc & remote access by ID via Internet in c#
HI remote viewing is not working !
hi good morning ser, i have a littile question..
sir how can i get server time if we have server name.
pls help me
client screen sharing version is not working inn your project even if i write ip , username , password of that client. i debugged it and found its getting connect but their is no display ! plzz help me …
it is not working in win 7 update version ans some of xp’s update may be there some change in windows remote control system.
it was my 2nd year project , now i m completely far away from computer networking. so i cant help u, but u can post ur problem in stackoverflow, i m sure u can get help
can u plz give me code for vb.net for getting connected pc on lan??\
my id= sonijaymin@yahoo.com
actually m searching foe remotly installer software..
its my last year project as well as m searching foe code for that plz help me out…
if possible for u can u plz mail me the updated(multiple client access) copy of this(Controlling PC And Remote Access via lan in c#) project to mail address.
My mail id :stcs.tvm@gmail.com
hello kishore.. i used ur project and liked it, but yet there is some problem in my view. Plz resolve my prob.. the prob is that I dont want to logoff the client machine whenever I remotely access that machine. i.e. that user doesnt know what is happening in his machine….. Kindly help me for the same….
sir we want to implement the remote access pc concept over internet for our project
can you please help us
Hello,
My problem is ,how to prevent the logging off of client machine in remote access.I want that client can see what the server is doing with client macine,in c#.net.
Pls….. if anyone know,send me code in c# as soon as possible…….
Hi Sir can you please send the source code to my email:
good_c_ryan_19@yahoo.com
I wasnt enable to download your source code on your site.
Is it possible to control client windows forms form.show and form.hide from server winform application? Can i have a sample..
Thanks in Regards
Can You send The Source code on my email Id vakhilesh12@gmail.com
Thanks In Regards
Sry..but i am not able to download the source code from the above link…can u plz give an another link from where i can get this…..thanks…My mail id is: rmrammohan2@gmail.com
Sry Sir, i am not able to download the source code from the above link…can u plz give an another link from where i can get this or send the source code in my mail id:-KumarBhutesh@gmail.com, its urgent sir i need it…..thanks,
Srry Sir., I am not able to download the source code from that link. If you are so kind-enough, can you mail this source code to the following mail.
kanishka.hewapathirana@gmail.com
I think this will help me to complete my project. Sir it is urgent………
Thank you.
Hi Kishor,
Could you please e-mail me the source code as the mentioned download links are not accessable.
e-mail:- neeraj.chauhan3108@yahoo.co.in
Regards,
Neeraj Chauhan
can you send my the file coz the link not found !!
alhammouri01@gmail.com
downloadlink not working please can u send me download link or file on my mail id
sandeepkanade20@gmail.com
sir plz send me the source code of this project on my email id “tanvirs47@gmail.com”
download link is not working sir plz.
for project subbmission
Hi Sir can you please send the source code to my email:wawza_nakarin [at] hotmail.com
thank you
Please send the source code of this project at abhishekkumar.miracle@gmail.com as I had to use this in my project and I want to enhance it if possible.
Hi
Sir please send this code to my mail id
praveennn2@gmail.com
Thanks
Praveen S
Hi
Sir please send this code to my mail id
csingh2008@gmail.com
Thanks
Chandan
Hi,
You’ve done awesome work. Pls send this code to my email datdb2008@gmail.com
Thanks.
Dale
Download link is not working plz send this code to my email gpr.456@gmail.com
Thanks
Download link is not working :S h.ibrahimnuroglu@msn.com
Pls send the code ….. just.check.me.out@gmail.com
Sorry sir I dont understand where did you came up with variable rdp where did we create that object?
Salam
Brother your given link is not working….can u send me the source code
waqasberet@gmail.com
thanks
plzz plzzz send me source code… of thos project.. downlopading link is nt working.. plzz plz… send me or contact me.. help me buddyyy.. email ID r.gupta2508@gmail.com
thanxxxx…
can you please e-mail me
the source code as the mentioned download links are not accessable.
kind regards
Thank you very much :))
You are very fast :))
can you mail me dis project pls my id sjdivi@gmail.com
plzzzzzzzzzzzzzzzzz sir send ur proj code file at this e-mail id amara861@gmail.com
i need it todayyyyyy our tomarrow………………….
i face two errors ” rdp don’t exist in current contaxt” and “the type our namespace IMsTsc nonscriptable”
sir plz help me for resolving these errors……………………………….
Hello sir, the download link is not working plz help me and mail me on harsh.varudkar@hotmail.com
Can you plz send me code on my mail ID mshahzadseraj@gmail.com
Hello sir.. Can you please email to me the code this is my email address
roylandrix@gmail.com
thank you for the article.
could you reupload it or send it to my email, please? reklamarsiv[at]gmail.com
i got your mail. thank you so much.
Send me this Project.this mail anjum.muskan.pak@gmail.com
plzz send me source code of this project if u got it.. plzz plzzz help me plzzz……
anjum_muskan_pak@yahoo.com
Plz send the source code to my tskreddyt@gmail.com
plz send me the source code.. goltekar61@gmail.com
I’ll be glad you for sending me the source code. Here is my e-mail address: mysvnc@hotmail.com
please send the source code at syedkashif226@gmail.com
Hi Sir,
Can you send this source code on kingvipul@gmail.com?
Thanks in advance.
This project is extremely awesome.
Will you please send me the source code on my email address.
aggarwal.lalit93@gmail.com
Hello !! I can’t download the code from the link above. Can you please send the code to alexandr.juravliov@mail.ru ? thanks a lot !!!!
Hi, I can’t download your Full Source Code.. Can you please send the source on my email address : mchuatak@gmail.com
Thanks a lot for your help…
Hello Sir,
This is the great project, your work is awesome.
But sir downloading link is not working
Plz plz send me this project at my mail
premsk_09@yahoo.com
This great your project but I can not download it I would send:
amezcua92@hotmail.com
Hi sir this project is grt .. i am not able to download can you mail me dis project pls my id sjdivi@gmail.com
can you tell me how to set the properties of user name and password
The source code file is removed..I cannot download it…Please help me out Sir…Thank you.
Please mail me the code —- arup_dolui@yahoo.com
hi sir there is d problem on source code page ,,,,, and i want this code so plz sir send me code on umakant.dudhbhate@gmail.com
Anyone have the project to download or to email???
my email is rcouto@creativethinkers.eu
I would apreciate a lot
thanks
Plz send me the code sumit02.saurav@gmail.com
I am not able to download the code from the link.
Any one who have got the complete code please send me.
plz sir send ur project code file at this e-mail : waleed_wam2010@hotmail.com
I am not able to download the code from the link.
i need it today our tomarrow………………….
I can’t download the code. please send the code to ayodhnya@gmail.com
I can’t download the code. please send the code to
please send the code to sverwaaijen@gmail.com
thank you
I can’t download the code. please send the code to
please send the code to howardteoh1990@gmail.com
thank you
Sir please send the code to me.. ^_^
elf_morphin@yahoo.com
please send me source code
stargag@hotmail.com
which library files did u use please say?????
Many users have demanded the source of your application. Are you planning on releasing the source freely any time soon? Thanks.
please send me your code i can’t download it..plz send me your code on simi.ku.cse@gmail.com
i really need it.
Sir i can not download the code from the link.
Would you plz send me the project code file at this e-mail : rosni.bd@gmail.com
i really need help from it for my project
Can you please send your code on this email id
tehreem.me@gmail.com