-2

I have two applications on separate computers. The first app called A should be on PC1 and the second app called B should be on PC2.

They will be connected via the same LAN. The only function of app A is to activate a Windows login app, B.

I don't know what kind of connection to use or how to connect them.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Overpool
  • 1
  • 1
  • What have you tried? Please show us some code so we can helop – Mouse On Mars Mar 20 '19 at 19:11
  • There are too many ways to approach this problem. The answers would just turn into a straw-poll for which one people liked. The best thing is to do some research on the topic yourself, find two or three, _analyze_ them, determine if they work for you or not, and _try them out_. Come to us when you have a specific question about something you have attempted to do. – Patrick Artner Mar 20 '19 at 19:22
  • See f.e. [what-is-the-simplest-method-of-inter-process-communication-between-2-c-sharp-pro](https://stackoverflow.com/questions/528652/what-is-the-simplest-method-of-inter-process-communication-between-2-c-sharp-pro) – Patrick Artner Mar 20 '19 at 19:23

1 Answers1

0

If connection is safety critical in your app you need to use TCP/IP, if is not just use UDP Socket connection. It recommended for short messages.

UDP connects other LAN PC with it's IP and PORT number and also your server PC (A or B) need to listen it's port. Example for Client Side:

Client = new TcpClient("192.168.1.1", "1111");
Stream = Client.GetStream();
Stream.Flush();
data_inc = new Byte[256];

data_inc = System.Text.Encoding.ASCII.GetBytes("Your MESSAGE" + "\n");

Stream.Write(data_inc, 0, data_inc.Length);
Array.Clear(data_inc, 0, data_inc.Length);

// Read the first batch of the TcpServer response bytes.
bytes = Stream.Read(data, 0, data.Length);

//if you recieve any response 
responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes);
TylerH
  • 20,799
  • 66
  • 75
  • 101
Mert Akkanat
  • 111
  • 7