Originally Posted by
amit1983
1. when I wrote: "I want to allocate all the necessary classes and variables at the initialization (and not at run time)." I meant that I cant (don't want to do something like:
byte[] data = new byte[len];
in the middle of the run time (I can allocate memory just in the start up (using pools))
So you want to use and
re-use one (or more) byte[] buffer(s), isn't it? If the size is sufficient for your datas, technically it is surely possible. If it has sense .... depends on what/how you want to send/receive.
Originally Posted by
amit1983
2. Just to be sure, if I will use serialization and send structure to an application which was written in c++, then the other application (in c++) will have problem to read the data (because it expect for structure with known fields, and not for a new message (serialize message),
am I write ?
Networking, in general, is based on well defined protocols and standards. Two systems that communicate to each other must "speak" the same protocol/standard. If you develop only one end and the other is already existent (or will be developed by other developers), you must know or agree the communication protocol.
Without these premises we can sit here and argue until the next year.
Originally Posted by
amit1983
3. If I have a structure which I need to send (via UDP or TCP),
what is the best way too send it ?
There's no "best" way, said in general. It depends on (just a few points that come to mind):
- how the data structure is made
- which data types contains
- what are the systems (and programming languages) involved
- if the communication is unidirectional or bidirectional
- if bidirectional, if it's synchronous or asynchronous