473,803 Members | 3,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

linked list ?

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,
Feb 27 '07 #1
2 2294

"LTDEV" <no*@pam.plwrot e in message
news:OL******** ******@TK2MSFTN GP02.phx.gbl...
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,
Perhaps something here will fit the bill?

http://msdn2.microsoft.com/en-us/lib...wz(VS.80).aspx

http://msdn2.microsoft.com/en-us/lib...4s(VS.80).aspx
Feb 27 '07 #2
Well, LinkedList<Twou ld be a good start: http://msdn2.microsoft.com/en-us/library/he2s3bh7.aspx

If it doesn't do everything you need, it wouldn't be hard to roll your
own...

Marc

Feb 27 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
7960
by: Jeffrey Silverman | last post by:
Hi, all. I have a linked list. I need an algorithm to create a tree structure from that list. Basically, I want to turn this: $list = array( array( 'id' => 'A', 'parent_id' => null, 'value' => 'aaa') , array( 'id' => 'B', 'parent_id' => 'A', 'value' => 'bbb') , array( 'id' => 'C', 'parent_id' => 'B', 'value' => 'ccc') , array( 'id' => 'D', 'parent_id' => 'A', 'value' => 'ddd')
11
3102
by: C++fan | last post by:
Suppose that I define the following class: class example_class{ public: example_class(); void funtion_1(); void function_2(); protected:
5
859
by: Dream Catcher | last post by:
1. I don't know once the node is located, how to return that node. Should I return pointer to that node or should I return the struct of that node. 2. Also how to do the fn call in main for that LOCATE subroutine that returns a node???? Any help would be appreciated. Thanks
10
15137
by: Kent | last post by:
Hi! I want to store data (of enemys in a game) as a linked list, each node will look something like the following: struct node { double x,y; // x and y position coordinates struct enemy *enemydata; // Holds information about an enemy (in a game) // Its a double linked list node
6
4603
by: Steve Lambert | last post by:
Hi, I've knocked up a number of small routines to create and manipulate a linked list of any structure. If anyone could take a look at this code and give me their opinion and details of any potential pitfalls I'd be extremely grateful. Cheers Steve
12
15101
by: Eugen J. Sobchenko | last post by:
Hi! I'm writing function which swaps two arbitrary elements of double-linked list. References to the next element of list must be unique or NULL (even during swap procedure), the same condition should be kept for references to previous element of list. Here is my solution below: struct node {
12
3955
by: joshd | last post by:
Hello, Im sorry if this question has been asked before, but I did search before posting and couldnt find an answer to my problem. I have two classes each with corresponding linked lists, list1 and list2, each node within list1 has various data and needs to have a pointer to the corresponding node in list2, but I cant figure out how to do this. Could someone explain what I might be missing, or maybe point me in the direction of a good...
1
15558
by: theeverdead | last post by:
Ok I have a file in it is a record of a persons first and last name. Format is like: Trevor Johnson Kevin Smith Allan Harris I need to read that file into program and then turn it into a linked list. So on the list I can go Trevor, Kevin, Allan in a straight row but I can also call out there last name when I am on their first name in the list. Sorry if it doesn't make sense trying to explain best I can. So far I have // list.cpp
0
8636
by: Atos | last post by:
SINGLE-LINKED LIST Let's start with the simplest kind of linked list : the single-linked list which only has one link per node. That node except from the data it contains, which might be anything from a short integer value to a complex struct type, also has a pointer to the next node in the single-linked list. That pointer will be NULL if the end of the single-linked list is encountered. The single-linked list travels only one...
7
5776
by: QiongZ | last post by:
Hi, I just recently started studying C++ and basically copied an example in the textbook into VS2008, but it doesn't compile. I tried to modify the code by eliminating all the templates then it compiled no problem. But I can't find the what the problem is with templates? Please help. The main is in test-linked-list.cpp. There are two template classes. One is List1, the other one is ListNode. The codes are below: // test-linked-list.cpp :...
0
9703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10295
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9125
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7604
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5500
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.