我正在使用.net 4.6 EasyModbus(我也尝试了nmodbus4,但存在相同错误)tcp客户端库连接到TCP Modbus服务器(硬件设备)。我无法控制充当我的tcp服务器的硬件设备。我正在用树莓派拉伸在Raspberry Pi 2上的Mono中运行我的程序。
我一直收到此错误:
Exception System.IO.IOException: Unable to read data from the transport connection: Operation on non-blocking socket would block. ---> System.Net.Sockets.SocketException: Operation on non-blocking socket would block
at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.Net.Sockets.SocketFlags socketFlags) [0x00016] in <f74b9f2fea8d47a7922726922726600e468191>:0
at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x0009b] in <f74b9f2fea8d47a7922726600e468191>:0
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x000e2] in <f74b9f2fea8d47a7922726600e468191>:0
at EasyModbus.ModbusClient.ReadHoldingRegisters (System.Int32 startingAddress, System.Int32 quantity) [0x00579] in <a086c8acfd1f4a5d8715dc8f400211ae>:0
有关我的设置的详细信息:
uname -a: 4.4.27-v7+ #917 SMP Tue Oct 25 16:00:29 BST 2016 armv7l GNU/Linux
.net framework 4.6
Mono JIT compiler version 5.18.1.0 (tarball Fri Mar 15 21:15:07 UTC 2019)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: normal
Notifications: epoll
Architecture: armel,vfp+hard
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: yes(600)
Suspend: preemptive
GC: sgen (concurrent by default)