Telnet Comm Troubleshooting Camera Trigger

I am having trouble triggering a Cognex camera via Telnet from a UR script. I can send the command through a telnet connection to the camera from my laptop to trigger the camera. However I don’t get a response when doing this through the UR Script.

I referenced this thread along with others that gave me a hint that this can be done and I shouldn’t give it yet.

I have a script file in the before start as shown below.
Before Start
global Conn= False
def ConnCameraTelnet():
while (Conn == False ):
global Conn=socket_open(“x.x.x.xxx”,23)
popup(“socket open”, “Message”, False, False, blocking=True)
end
end
def telnet_send(str):
socket_send_string(str)
socket_send_byte(13) #send carriage return (CR)
socket_send_byte(10) #send line feed (LF)
end
The main robot program looks like this and I have turned off loop forever.
Robot Program
4 ConnCameraTelnet()
5 telnet_send(“sw8”)
6 Wait: 5.0

Please let me know if you see anything that I need to change. Note: I have the camera set to Industrial Ethernet.