From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 56 in TCP IP Communication

Hi All,

 

 I am developing Test Cases to Test our Product, I am using TCP IP Communication to communicate the Hardware (Not NI Hardware) where a firmware is running inside. in the test cases i will communicate the firmware and request it to give me required information in a specified format, it will in response will give the required information. So as I have test cases, I will be opening and closing the port for each test case. till here every thing is going well, but after some test cases are executed I an getting a error 56 while i am trying to open the port.

I am using TCP Listen VI form TCP/IP Pallet; I am sure that not because of Firewall issue.

Please suggest me what could be the reason and solution for it

 

Thanks and Regards,

Phani.

0 Kudos
Message 1 of 7
(11,497 Views)

Why are you using TCP Listen in your code? This is used when you are writing a server that will accept connections from remote devices. From your description it sounds like you need to open a connection to the remote device. Also, can you post your code or example code that shows when you get the timeout error (error 56 = timeout). Generally you get a timeout error when you are writing (rare) or reading from a connection. You can also get a timeout when opening a connection. If you are getting the timeout on a read are you reading the data correctly? That is, generally the data will be a fixed format and you will know how many bytes you need to read. The data may also be written to include the amount of data which is being sent. Or a very common method for simple devices is to use a termination character to mark the end of the data. You need to know how your data should be received and use the correct method for reading the data. If you simply specify to read 1024 bytes but the device only sends you 50 you will timeout. You would have to look at the data to see if you received the complete response.

 

If you are truly using TCP Listen you may be sitting there waiting for someone to talk to you but the device is nevers trying to connect. As mentioned earlier you may need to use TCP Open instead to establish the conenction with the device.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 7
(11,479 Views)

Hi Mark,

 

Thanks for your responce,

 

As you said I am opening a connection to the remote device, thays why i am using TCP Listen.

 

I am getting error-56 at TCP wait on Listener in TCP Listen VI. I have attached the TCP Ip Example code.

 

Thanks,

Phani

0 Kudos
Message 3 of 7
(11,465 Views)

If you are opening a connection to a remote dvice you should use TCP Open. Wait on listener is used when you are implementing a server which remote devices will connect to. When opening connections to remote devices all you need is:

 

TCP Open followed by TCP Read/TCP Write and finally a TCP Close when communications are complete.

 

You are getting a timeout error on your TCP Wait On Listner because no one is trying to establish a connction with your application.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 7
(11,459 Views)

Is the example you posted for the code that will be on the remote device? Or is it for the code in your test program that will communicate with the remote device. The reason I ask is that as written it appears to be more like server code since it does a read first and then a write. If the code you psted is the server end you need to specify no timeout for the TCP Wait. This will allow the process to run and wait indefinitely for a connection to be esatblished. However I don't thing this is what you are doing.

 

If I understand you correctly you are writing the code for your test application which will establish a connection to the device, send it a command and then if necessary read the repsonse back. Your code would then be:

 

"TCP Open -> TCP Write [->TCP Read if necessary] -> TCP Close." (Sorry for the text based LabVIEW example)

 

You may not need to open and close the connection for every test. You may only need to open the connection once in the beginning of the test and then close it at the end of all the tests.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 5 of 7
(11,454 Views)

Yes, I have to write and read back the data from the server.

 

In my application i will request the server for a connection and wait for its responce.

 

In our application we call one test case at a time and run that and close it, then next test case is called. so i am opening the connection and closing it for each test case.

 

As you said I can open the connetion once and close it at end of all test cases, i tried it by passing the connection reference from one test case to other through a global variable. but it is not paasing the referance as expected. and the error is generated.

0 Kudos
Message 6 of 7
(11,445 Views)

Hello Kudos,

 

nice to meet you. I have some questions for you. Hope you can help me.

 

I'm developing an HIL (Hardware in the Loop system) using NI tools. I have an host PC connected via Ethernet with  the HIL PIX.

From VeriStand the deployment of the HIL project gets stopped cause of Error 56.

 

This appens randomly, sometimes  the deployment is succesfull.

 

Could you give me any suggestions? I can't use Labview.

 

Thanks

Mike

0 Kudos
Message 7 of 7
(10,725 Views)