![]() ![]() ![]() ![]() ![]() ![]() |
||
![]() |
||
![]() ![]() ![]() ![]() This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
![]() |
![]() |
#1 |
Lifetime Supporting Member
![]() ![]() Join Date: Jul 2009
Location: Escuminac
Posts: 663
|
Help with my first TCP Socket program
I'm trying to set up a TCP Socket connection between a CompactLogix 1769-L16 and a printer that can receive external data through a TCP socket.
I know the printer IP address and port (192.168.25.112:10000) and I can send the printer a message using Hercules setup utility I have a sample program from Rockwell (Socket TCP Client) imported into my program and I can get the "Delete All Socket Requests" and "Create Socket Request" messages status to change to DN The next message block always fails with error code 16#0000_0046, which indicates that: Connect Service message: – Server IP exists, but port does not. – Server IP and port exist, but it does not accept connection on this port. – Service ‘timeout’ value in UDT set to 0 or low value Since I know the IP address and port are correct, it leads me to think the timeout value is too low, but I have absolutely no idea how to increase it. Can anyone help?
__________________
"If you can't measure it, you can't manage it!" |
![]() |
![]() |
#2 |
Member
|
1. printer OFF for a few seconds, then ON again.
2. Timeout in OpenConnection source |
![]() |
![]() |
#3 |
Member
|
Port 10000 looks very suspicious.
Did you try a Telnet connection to this port? It’s typically port 9100. There is a printer sample code in the Knowledgebase that I know works. You can also do a wireshark trace and post it here. |
![]() |
![]() |
#4 |
Lifetime Supporting Member
![]() ![]() Join Date: Jul 2009
Location: Escuminac
Posts: 663
|
Port 10,000 definitely works. I was able to send the message to the printer over this port using Hercules
__________________
"If you can't measure it, you can't manage it!" |
![]() |
![]() |
#5 |
Member
|
I don't know what the Hercules does, but if it works, can you do a Wireshark trace and post it here along with PLC traffic capture.
If you think that port 10000 is correct, why not to get a print sample code from the Knowledgebase and change port there from 9100 to 10000? |
![]() |
![]() |
#6 | |
Lifetime Supporting Member
![]() ![]() Join Date: Jul 2009
Location: Escuminac
Posts: 663
|
Quote:
Hercules setup utility - https://www.hw-group.com/software/he...-setup-utility
__________________
"If you can't measure it, you can't manage it!" |
|
![]() |
![]() |
#7 |
Member
|
Unfortunately, you are not giving us any information that can help.
Post wireshark traces and your ACD file upload in faulted state. You are saying that you are using Socket Client Program (in the first post), I am telling you to get Printer Sample application. |
![]() |
![]() |
#8 |
Lifetime Supporting Member
![]() ![]() Join Date: Jul 2009
Location: Escuminac
Posts: 663
|
Solved
I finally figured this out, and it was by pure luck…
As I mentioned previously, I was able to send a message to the printer using Hercules from my PC, but was unable to send it from a PLC. Wireshark wasn’t an option due (stupid reason). At the end of the day on Thursday, I happened to glance at the path to my PLC in RSLogix and noticed it was 10.250.1.11. This confused me, as the network diagram clearly indicated the PLC was assigned an address of 192.168.25.11. I checked the network configuration on the PC and found it had three assigned IP addresses - 192.168.25.202, 10.250.1.202 and 10.172.216.202. Upon further investigation, I found a NAT device in a control cabinet. The NAT converts devices from 192.168.25.xxx to 10.250.1.xxx Because the PC was assigned an IP address in each subnet, I was able to ping and connect to the printer and PLC, but the printer was connected to the “public” side of the NAT, so the PLC couldn’t see it I’ve since modified the sample code to cascade through the necessary MSGs and it works fine. I hope someone takes something away from this. I can’t say enough about as-built diagrams!
__________________
"If you can't measure it, you can't manage it!" |
![]() |
![]() |
Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Compactlogix TCP Socket OpenConnection to Zebra Printer | radamson | LIVE PLC Questions And Answers | 5 | June 18th, 2022 07:25 PM |
TCP Socket Communication with A-B's between Logix Controllers | Finnbliss | LIVE PLC Questions And Answers | 4 | August 3rd, 2021 08:53 AM |
Help me make this program more efficient. Issues with detecting sensors for... | Brandon_K | LIVE PLC Questions And Answers | 7 | September 11th, 2016 10:36 AM |
TCP Socket Client Error 16#11 | AndyEM | LIVE PLC Questions And Answers | 4 | August 7th, 2016 01:01 PM |
SCADAPack-334 Modbus TCP Sample Program | halburgepramod | LIVE PLC Questions And Answers | 1 | July 16th, 2010 09:57 AM |