I am trying to connect the medical equipment with LAN cable. and i am using C# based windows application to receive the data which machine is sending when any blood sample runs in machine
As per my requirement i need to use TCP listner to recevie the data which machine is sending.. but when i connected medical equipment(ip address - 198.168.1.10) with my laptop(ip address- 198.168.1.11) throw lan then i am getting error message like "The requested address is invalid in this context".
(I already checked both sender ip is able to ping from laptop as well).
Then i read may articale and find that need to use IPADDRESS.ANY. But this will not help me.
Means sender machine says ///when cursor comes to start the listener then it is throwing the error msg. please check network connection...
pasting my code here.. please check and help me with this
//Code start
//Posting my complete code
string response = String.Empty;
IPAddress ipAddress = IPAddress.Parse("198.168.1.10");
Socket client;
TcpListener listener = new TcpListener(ipAddress,5100);
listener.Start();
byte[] data;
while (true)
{
client = listener.AcceptSocket();
var childSocketThread = new Thread(() =>
{
data = new byte[4096];
int size = client.Receive(data);
ASCIIEncoding encoder = new ASCIIEncoding();
string returndata = Encoding.UTF8.GetString(data);
// Get response
string responce = responcemsg();
client.Send(Encoding.UTF8.GetBytes(responce));
//Custom save funtion
callsave(returndata);
client.Close();
});
childSocketThread.Start();
}