I am using the TcpBinding and interacting with a Moxa (TCP to Serial) converter to read one MBUS Device.
To intialisation of the MBusMaster I use following code:
_var serializer = new MeterbusFrameSerializer();
endpoint = new IPEndPoint(IPAddress.Parse(“192.168.100.41”), 4001);
binding = new TcpBinding(endpoint,serializer);
binding.Error += Binding_Error;
binding.IoCompleted += Binding_IoCompleted;
master = new MBusMaster(binding);
master.Meter += Master_Meter;_
Afterwards I am calling RequestData every five seconds:
var response = master.RequestData((byte)MBusAdr, TimeSpan.FromSeconds(3)).Result as VariableDataPacket;
This works only for the first call. The second call rises following exception (Socket Exception):
AggregateException SocketException: A request to send or receive data was prevented because the socket is not connected and (when sending via a datagram socket with a sendto call) no address was specified
I am using the TcpBinding and interacting with a Moxa (TCP to Serial) converter to read one MBUS Device.
To intialisation of the MBusMaster I use following code: _var serializer = new MeterbusFrameSerializer(); endpoint = new IPEndPoint(IPAddress.Parse(“192.168.100.41”), 4001); binding = new TcpBinding(endpoint,serializer); binding.Error += Binding_Error; binding.IoCompleted += Binding_IoCompleted; master = new MBusMaster(binding); master.Meter += Master_Meter;_
Afterwards I am calling RequestData every five seconds: var response = master.RequestData((byte)MBusAdr, TimeSpan.FromSeconds(3)).Result as VariableDataPacket;
This works only for the first call. The second call rises following exception (Socket Exception):
AggregateException SocketException: A request to send or receive data was prevented because the socket is not connected and (when sending via a datagram socket with a sendto call) no address was specified
Is there anything wrong in my workflow or code?