Click here to Skip to main content
14,977,259 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I create two simple application on my local machine 1. Server , 2 Client
I want to get client info on server, locally i am able to do.
But when i am booting any other laptop through LAN, I want to run my client code on that laptop, so that i can pick the data from laptop to my machine.

What I have tried:

C#
<pre>static void Main(string[] args)
        {
            TcpListener server = new TcpListener(8888);
                server.Start();
            Console.WriteLine("Server started and waiting for client");


            Socket socketforClient = server.AcceptSocket();

            if (socketforClient.Connected)
            {
                //Send Messsage from Client
                NetworkStream ns = new NetworkStream(socketforClient);
                StreamWriter sw = new StreamWriter(ns);
                Console.WriteLine("Server >> Welcome Client");
                sw.WriteLine("Welcome Client");

                sw.Flush();

                //Get Messsage from Client
                StreamReader sr = new StreamReader(ns);
                Console.WriteLine("Client >>" + sr.ReadLine());

                sw.Close();
                ns.Close();
            }

            socketforClient.Close();
        }
Posted
Updated 1-Jul-20 21:17pm

1 solution

You can't start an app on the client machine without jumping through some real hoops, and having admin control over the machine - which is not the default for good reason.

Certainly, you can't start a WinForms app on a client until the client has logged in, as there is no way for it to interact with a user until then.

A much, much simpler approach is to have it installed to boot on startup: How to launch application at logon/startup[^]
   
v2
Comments
Shakir Ali 3-Jul-20 23:56pm
   
Thanks for your response, I got your point.
Is there any use of PXE boot or DHCP ? because for long run I want to host my application on a server, and through LAN i will boot multiple laptop at once, for those laptop, i need to save motherboard info on my server.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900