Hello, we have a Moxa hooked up to a scale serving on a TCP/IP when I try to read from socket I get...
Caused by: org.python.core.PyException: _socket.error: [Errno 10061] Connection refused
or when I try adding as a device I get...
...drivers.TCPDriver[Moxa].TCPConnection[49 Error connecting to 192.168.98.233:4990. Cannot assign requested address: bind: /192.168.98.233:4990
Did you mistakenly put the Moxa IP address into the "Local Address" of the TCP Device settings?
I have the gateway as local
Try removing it. It's almost never necessary, generally only used to specify a specific NIC to make the connection from in a multi-NIC host when your routing tables are broken.
That said, it probably still won't work, because it looks like you have a plain ol' network/firewall/configuration error. (TCP connection refused)
Would tcp driver be the correct driver?
Yes. Maybe. Depends what you have on the other side of this thing.
I'm thinking its a firewall issue as well. I can write to socket to send zpl code to a printer. But I get connection refused when trying to read from socket.
You sure you're not opening a second socket without closing the first or something?
Connection refused happens when you open it, not when you read. If you were actually able to write you already opened it.
Share some code, maybe take a Wireshark capture.
s = socket.socket()
it hangs up and connection refused
Right, so that's where the plain network/firewall/whatever issue is. But then you mentioned you can write...
I can write to a different address the printer on. Maybe IT added a rule? They haven't been helpful.
Also, FWIW, if you search "ZPL" on the forum you'll find a few different posts where people have done this via scripting. It's probably better than trying to use the TCP driver. But you still have to figure out the network or configuration problem first.
Alright. So we got it hooked up and receiving data. Now I am coming across this issue.
The value keeps cycling through each portion in the opc tag.value
S... T... +... 188...lb... etc
Is there a way to grab just the data section?
What message and delimiter settings did you configure the TCP driver with?
None? lol. taking a look now
Switch to Message Based with a delimiter of “\r\n”.
You’ll get the whole message as the value and you can split or process it up in Ignition with a value change script or expression.
Thank you so much!
trying it now.
I dont see messageBased on here.
CharacterBased with the \r\n in the Field Delimiter?
Oops, I guess I meant Character Based.
I think leave the Field settings alone.