Help with my first TCP Socket program

rguimond

Lifetime Supporting Member
Join Date
Jul 2009
Location
Escuminac
Posts
665
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?
 
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.
 
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.

Port 10,000 definitely works. I was able to send the message to the printer over this port using Hercules
 
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?
 
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?

That's exactly what I did (sample code from knowledgebase). I figured that changing the tag values for the IP address and port would have done the trick, but I guess not.

Hercules setup utility - https://www.hw-group.com/software/hercules-setup-utility
 
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.
 
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!
 

Similar Topics

I have a question for you ControlLogix gurus out there. I have a measurement device that uses RS232 communications. I'm using an AnyBus...
Replies
5
Views
3,626
Hello, I am trying the AOI provided by Rockwell to read Modbus TCP, the version is 2.04 The connection looks good to the modbus server. I...
Replies
4
Views
542
Hello Guys, I have a project were i am using LaserDESK to control a scanhead and laser. I need to send commands to LaserDESK from my PLC...
Replies
0
Views
840
I am looking for a tool to backup/restore all my retentive located data from a wago 750-862 via modbus tcp. The wago address 12,288 equates to MW0.
Replies
11
Views
2,714
Hello, I need some help/advice. I have a Micrologix 1400 series B on surface at a mine site. Underground I need to read hart data from a flow...
Replies
6
Views
2,212
Back
Top Bottom