Ok, I’m looking to create a multi-access service, so I’m thinking I need each of my network service handlers to fire off in a new thread.
When NetworkCommsDotNet starts a packet handler, does it do so in a separate thread automatically, or do I need to arrange for that to happen as part of my code?
“does it do so in a separate thread automatically” – yes, threading is all taken of care automatically. It all gets executed within NetworkComms.CommsThreadPool, which is a customised, priority based Threadpool. Originally we used the threadpool provided by .net but it wasn’t flexible enough.
Which example to learn from how to deal with Thread Safety?
Or perhaps can you provide me with an example how you can store data into a list without loosing information when the same event is triggered at the near same time?
Just using lock seems to be to slow if there are to many requests…
now, i am rather new with C#… therefore embraced the simplicity of this network library… not having a provided solution for this facing this tough thread issue makes it kinda ironic 😉
I realize this network library is not Unity specific… which is unfortunate for me 😉
A better resource for asking these sort of threading questions is stackoverflow.com. You can use NetworkComms.Net to easily add networking to any unity projects and should you have any questions relating to networking feel free to post back here.