Page 1 of 1
TCP connection from PCAN to server application
Posted: Wed 7. Jan 2015, 14:54
by user1000
Hi,
It seems that the PCAN Ethernet GW DR automatically connects to our server application upon power on. However, when I quit the server application and restart it, there is no automatic reconnect from the PCAN. CAN messages from the CAN bus are apparently forwarded to the Ethernet side even if no connection is established but one or two telegrams are lost before the PCAN reconnects to the server application.
What would be the proper way of making sure that the PCAN reconnects if the connection is closed by the server? Does the PCAN notice that the server application is stopped?
Any help is much valued.
Re: TCP connection from PCAN to server application
Posted: Thu 8. Jan 2015, 11:26
by G.Lang
Hi,
do you use a socket-based communication, a communication via the PEAK-LAN driver or directly via 2 Ethernet-Gateways?
regards
Gunther
Re: TCP connection from PCAN to server application
Posted: Thu 8. Jan 2015, 15:05
by user1000
Hi,
Many thanks for your response.
G.Lang wrote:
do you use a socket-based communication, a communication via the PEAK-LAN driver or directly via 2 Ethernet-Gateways?
We are using a plain socket connection from the PCAN to our server software.
BTW, I am not aware of a 'lan driver'. Can it be freely downloaded from your website?
Looking forward to hearing from you.
Re: TCP connection from PCAN to server application
Posted: Fri 9. Jan 2015, 14:43
by K.Wagner
Hello,
user1000 wrote:We are using a plain socket connection from the PCAN to our server software.
please be sure that you are closing the socket before terminating your server. The socket on the PCAN Gateway side probably doesn't note the disconnection and that is why it not tries to reconnect.
user1000 wrote:BTW, I am not aware of a 'lan driver'. Can it be freely downloaded from your website?
The PCAN-LAN driver and the "Virtual PCAN-Gateway" is a software solution that emulates a PCAN-Gateway in a computer, providing access to the CAN data using the PCAN-Environment (eg. using PCAN-View). This product is in BETA stadium. Selected customers receive this for evaluation.
Re: TCP connection from PCAN to server application
Posted: Mon 12. Jan 2015, 14:23
by user1000
Hi,
K.Wagner wrote:
please be sure that you are closing the socket before terminating your server. The socket on the PCAN Gateway side probably doesn't note the disconnection and that is why it not tries to reconnect.
I am on a Ubuntu machine. What happens when do a shutdown on the socket is:
1 - My server app sends a FIN/ACK packet to the PCAN.
2 - The PCAN returns an ACK.
3 - My server app quits.
4 - My local socket is now in the state FIN-WAIT-2.
5 - The PCAN keeps sending TCP-Keep-Alives for another 60 secs each of which my local machine ACKs.
6 - After 60 secs, my machine sends an RST to the PCAN which is the last packet exchanged.
Thanks for your help.
Re: TCP connection from PCAN to server application
Posted: Mon 12. Jan 2015, 16:06
by user1000
*** UPDATE ***
I just noticed that when I have two connections open,
A/TX: client app connecting to PCAN for sending data to PCAN
B/RX: server app accepting connections from PCAN for receiving data from PCAN,
A/TX is closed as expected: Client sends a FIN/ACK, PCAN responds with FIN/ACK but
B/RX is only "half-closed", as described in my previous post.
Thanks.
Re: TCP connection from PCAN to server application
Posted: Tue 13. Jan 2015, 08:32
by S.Michaelsen
Hi,
ATM the reconnection is triggered by the first incoming CAN message on the CAN channel that belongs to the route. It seams as if this first frame is not sent to the peer in some cases after it has triggered the connection establishment.
Regards,
Stephan