The online racing simulator
Handling InSim UDP connection
(3 posts, started )
Handling InSim UDP connection
Hi! I'm updating my InSim C++ library to use the UDP connection method and I don't know what things I should do.

I grabbed an example I had done with MCI packets in which I used TCP, and just run it using an UDP socket. I hadn't tried UDP yet, but it worked just fine.

So, it looks like my library works with UDP, just using the corresponding argument in the initialization call (SOCK_DGRAM instead of SOCK_STREAM). But I wonder is that makes it... I mean, shouldn't I worry a bit abour lost packets or something like that?

This is my first time using UDP and I don't know what I should pay extra attention to.

Anyway, I think that maybe I'll just add UDP for NLP/MCI packets and do no checking at all. But in case I change my mind I'd like to know what to do
InSim V4 is made for TCP, since you don't have to send a confirm packet back to let the host know you received a packet. So you don't have to worry about it cus there is nothing you can do about it. For MCI/NLP this is acceptable because this is more like raw data, and there is no point for retreiving a lost packet. So I think its pretty essensial to use TCP for the main connection. If you use your program on a local network using TCP for MCI/NLP is fine because bandwidth/speed is not an issue then. Else you should use UDP for MCI/NLP for better performance.
Quote from T-RonX :InSim V4 is made for TCP, since you don't have to send a confirm packet back to let the host know you received a packet. So you don't have to worry about it cus there is nothing you can do about it. For MCI/NLP this is acceptable because this is more like raw data, and there is no point for retreiving a lost packet. So I think its pretty essensial to use TCP for the main connection. If you use your program on a local network using TCP for MCI/NLP is fine because bandwidth/speed is not an issue then. Else you should use UDP for MCI/NLP for better performance.

Awesome. That's what I was going to do. I was confused because of what you said that InSim has no confirmation for received packets when using UDP.

So, pretty clear now: I'll use TCP always for the main connection and let the programmer decide whether to use TCP or UDP for NLP/MCI packets depending on the UDPPort field of the IS_ISI packet.

Thanks for your help

Handling InSim UDP connection
(3 posts, started )
FGED GREDG RDFGDR GSFDG