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);