Hi,
I have Task/thread which continuous check for any can message and then I put into my queue. other thread check queue and send it over TCP/UDP continuous.
Does any one have experience with it?
Any performance issues.
UDP is not 100% reliable I do lost some can packets using boradcast or unicast destination address.
For TCP. it buffers my multiple messages togther. send them some time 30, 60 or 90 bytes.
As my can packets are small size max =30 bytes.
Can I avoid TCP buffering?
I also notice TCP do retry as well. so I receive duplicate message.
Using mongoose Web Server Networking API. I cannot continuously send packets because mongoose thread polling every 1ms.
I am using lwip BSD socket. It is better.
receiving can bus messages and send over UDP/TCP continuously
Re: receiving can bus messages and send over UDP/TCP continuously
I used idf sokets and they are blasting fast. We are talking transfers of 10+mbyte/s (TCP)
There is however buffer limit for single socket and number of non blocking calls on the system.
It is all in menuconfig - I must check that.
There is however buffer limit for single socket and number of non blocking calls on the system.
It is all in menuconfig - I must check that.
Re: receiving can bus messages and send over UDP/TCP continuously
What you mean by idf sokets?
Do you mean LWIP socket BSD API?
Kindly give me your menuconfig file and example code.
Do you mean LWIP socket BSD API?
Kindly give me your menuconfig file and example code.
Re: receiving can bus messages and send over UDP/TCP continuously
I mean sockets that come with esp-idf rtos. I guess lightweight library don't know if bsd compatible.
Those sockets work fine with windows sockets so what's the difference.
The speed is insane: example here
Those sockets work fine with windows sockets so what's the difference.
The speed is insane: example here
Re: receiving can bus messages and send over UDP/TCP continuously
I really doubt you are receiving duplicates. I've never seen that.snahmad75 wrote:I also notice TCP do retry as well. so I receive duplicate message.
I'm guessing that you don't want messages combined because you aren't parsing the stream and depend on getting a whole message per read. That's a fundamentally flawed way of using TCP. With TCP you should packetize your data and parse it.
However, you can try disabling the accumulation of data with the following....
Code: Select all
static void set_tcp_nodelay(int fd) {
int val = 1;
int rv;
rv = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &val, (socklen_t)sizeof(val));
if (rv == -1) {
dief("setsockopt", strerror(errno));
}
}
John A
Who is online
Users browsing this forum: No registered users and 109 guests