python-aprs / kiss3

A pure-Python implementation of serial KISS and KISS-over-TCP protocols for communicating with TNC devices
Other
2 stars 1 forks source link

KISS connection status #9

Open mattbk opened 1 year ago

mattbk commented 1 year ago

Please forgive me for not understanding how all of this works. Is there a way to query the status of a KISS connection? I am trying to figure out when/why the connection between my Python application and the direwolf server is dropping periodically.

Following the README example, I can get information about the connection k, but it doesn't seem to update what is happening on the other end of the connection. So even if I cut the network connection between the direwolf server and my local computer, I don't see a change in what k returns.

Thanks for any insight into how I should be approaching this. Existing APRS applications seem to have figured out how to know when a connection is lost, so I assume it is somehow possible.

hemna commented 1 year ago

I just ran into this as well today. My app (APRSD - http://github.com/craigerl/aprsd ) has support for TCP/SERIAL KISS connections to direwolf and In my network loop it seems that the kiss connection dies at some point, but there is no failure from the kiss3 api and I don't know how to tell the status of the connection to see if I need to rebuild it on failure for fault tolerance.

This block of code https://github.com/craigerl/aprsd/blob/master/aprsd/clients/kiss.py#L80-L84 is supposed to block forever (at least while I want the connection stay up and recieving data from the KISS interface). But at times My event loop calls that quickly over and over as the blocking

self.kiss.read(callback=self.parse_frame, min_frames=None)

returns quickly. There is no error, no exception raised.

mattbk commented 1 year ago

@hemna it's nice to know I'm not the only one!

(also, aprsd looks pretty neat)