L
LTDEV
Hi,
Im looking for a linked-list like structure in C#. Im a C++ programmer that
needs to make little module (TCP sockets communication) in C#.
I need to attach a buffer for incoming data because i have to decipher
incoming data and extract them into datapackets, and the forward them onto
the application.
In C++ i normally create a linked list, where i then push() the packets of
recieved data, in the decipher part i then pop a packet, run through the
pack to check if theres a complete package, i pass it onto the system,
stuffing the remaining characters back to the queue.
Example, a datapacket in this example starts with [0x02] and ends with
[0x04], the data i get in my first recieve is:
[0x02]12345[0x04][0x02]678
This is pushed into my buffer.
Then another segment is recived:
90[0x04][0x02]98765[0x04]
And this is pushed into my buffer.
What my buffer contains is 3 complete packets:
[0x02]12345[0x04]
[0x02]67890[0x04]
[0x02]98765[0x04]
Its seperated into two buffer elements (2 items in my linked list).
Then in the decipherpart i will start by extracting the first (FIFO):
I will look at this char by char and extract a complete datapacket, that
would be:
[0x02]12345[0x04]
This i will just pass on to the system, i will run through the rest of the
package, and in this example discover that i dont have any more complete
datapackets, therefore i have to push it back to the queue, but this time
ofourse only the remaining chars which is:
[0x02]678
In effect i would run through all the elements and extract the it, but if
you understand, what the issue is here is that i cannot be sure that one
buffer-element contains a complete datapacket, therefore it can be split
over several packets.
Therefore i need to be able to insert elements not only as normal push/pop
(FIFO) but i have to be able to push a packet into the beginning, or middle
or whatever.
Is there any C# classes that supports the above or do i have to make my own
? thanks and hope that it makes sense, sometimes its dangerous to go too
much into detail, this time i tried
Thanks,
Im looking for a linked-list like structure in C#. Im a C++ programmer that
needs to make little module (TCP sockets communication) in C#.
I need to attach a buffer for incoming data because i have to decipher
incoming data and extract them into datapackets, and the forward them onto
the application.
In C++ i normally create a linked list, where i then push() the packets of
recieved data, in the decipher part i then pop a packet, run through the
pack to check if theres a complete package, i pass it onto the system,
stuffing the remaining characters back to the queue.
Example, a datapacket in this example starts with [0x02] and ends with
[0x04], the data i get in my first recieve is:
[0x02]12345[0x04][0x02]678
This is pushed into my buffer.
Then another segment is recived:
90[0x04][0x02]98765[0x04]
And this is pushed into my buffer.
What my buffer contains is 3 complete packets:
[0x02]12345[0x04]
[0x02]67890[0x04]
[0x02]98765[0x04]
Its seperated into two buffer elements (2 items in my linked list).
Then in the decipherpart i will start by extracting the first (FIFO):
I will look at this char by char and extract a complete datapacket, that
would be:
[0x02]12345[0x04]
This i will just pass on to the system, i will run through the rest of the
package, and in this example discover that i dont have any more complete
datapackets, therefore i have to push it back to the queue, but this time
ofourse only the remaining chars which is:
[0x02]678
In effect i would run through all the elements and extract the it, but if
you understand, what the issue is here is that i cannot be sure that one
buffer-element contains a complete datapacket, therefore it can be split
over several packets.
Therefore i need to be able to insert elements not only as normal push/pop
(FIFO) but i have to be able to push a packet into the beginning, or middle
or whatever.
Is there any C# classes that supports the above or do i have to make my own
? thanks and hope that it makes sense, sometimes its dangerous to go too
much into detail, this time i tried
Thanks,