TCP Connection takes approx 250ms to get client.available() response on Teensy 4.1 #72
-
Hi, I've recently converted some hardware from Teensy 4.0 with Wiznet device to the Teensy 4.1 with built in Ethernet. Ive ported my code to QNEthernet and its running, however the TCP connection I use only seems to get updates to client.available() every 250ms or so regardless how fast my client polls the Teensy server. This wasn't the case on the old Teensy 4 hardware setup. I also have UDP sockets running and the response is as fast as my origonal Teensy 4 / wiznet setup. I tried adding Ethernet.loop() / yield() to my loop but this made no difference., and according to docs shouldn't be needed. Here is some timing with clinet.avaialble() followed by client.read() called within a continuous loop.
Any thoughts? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hi, Matt. Thanks for using the QNEthernet library. It’s likely that data is getting buffered and not being sent right away. Note that I’m assuming that you’re expecting a response to data being sent out the connection. This section of the Readme may help: https://github.com/ssilverman/QNEthernet/blob/master/README.md#write-immediacy Try calling flush() after sending data that needs to be immediately sent. |
Beta Was this translation helpful? Give feedback.
-
Hi, Thanks for the fast response! Yes you are correct and I had just found this in another post! so it was the server reply write() that was holding things up. I am now tetsing with flush() and the QNETHERNET_FLUSH_AFTER_WRITE option. Yes I need an imediate response as its a UI interface. Thanks! |
Beta Was this translation helpful? Give feedback.
Hi, Matt. Thanks for using the QNEthernet library. It’s likely that data is getting buffered and not being sent right away. Note that I’m assuming that you’re expecting a response to data being sent out the connection. This section of the Readme may help: https://github.com/ssilverman/QNEthernet/blob/master/README.md#write-immediacy
Try calling flush() after sending data that needs to be immediately sent.