473,698 Members | 2,480 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

std::list problem

Hi all,

i am facing some problems with list..

i am receiving some data from some sender and i am storing this data in
to list.

i am receiving and storing all the packets in the list till i receive
bye packet.
and once i receive bye.. i am poping all packets from the list and
writing it to a file...

now, problem is , say if i sender is sending me a file of 20000 bytes
and the packet size is 100 then i will received 200 packets and 200
packets will be pushed in to list.
now i am creating my file using the contents in the list.....

well, if i am receivng the same file with lesser packet size then no of
packets increase and so no of nodes in the list increase ... so
sometimes it crashes in between..
is there any limit for the no of nodes of the list....

any help will be appreciated.

thanks,
Munish Nayyar
emanshu

Oct 26 '05 #1
3 1669

"emanshu" <mu*******@gmai l.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Hi all,

i am facing some problems with list..

i am receiving some data from some sender and i am storing this data in
to list.

i am receiving and storing all the packets in the list till i receive
bye packet.
and once i receive bye.. i am poping all packets from the list and
writing it to a file...

now, problem is , say if i sender is sending me a file of 20000 bytes
and the packet size is 100 then i will received 200 packets and 200
packets will be pushed in to list.
now i am creating my file using the contents in the list.....

well, if i am receivng the same file with lesser packet size then no of
packets increase and so no of nodes in the list increase ... so
sometimes it crashes in between..
is there any limit for the no of nodes of the list....

any help will be appreciated.

thanks,
Munish Nayyar
emanshu

I doubt if you are running into a limit, the number of nodes is largely
limited by your available memory and the address space of your computer,
200 nodes is quite a small number in this regard.

Are you using threads ? I suspect that you have two threads which need
to be synchronized properly, otherwise you will corrupt the list structure
and cause a crash.


Oct 26 '05 #2
emanshu wrote:
Hi all,

i am facing some problems with list..
[snip]
well, if i am receivng the same file with lesser packet size then no of
packets increase and so no of nodes in the list increase ... so
sometimes it crashes in between..
is there any limit for the no of nodes of the list....

No, you have a bug in your program. Post the code and we can fix the bug.
any help will be appreciated.

No problem.
thanks,
Munish Nayyar
emanshu


John
Oct 26 '05 #3
There is no limit on no. of lists...
check ur copy constructor ...it might have the problem

Ravi

Oct 26 '05 #4

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

Similar topics

3
3952
by: Mike Pemberton | last post by:
I'm sure there's a good explanation for this effect, but I get rather a strange output from this little test: #include <iostream> #include <list> int main() { std::list<int> int_list;
3
6803
by: Kyle Teague | last post by:
I have a list of pointers to structs as a private member of a class. If I call begin() in the same function as I added the data then no access violation occurs. However, if I try to call begin() in a member function of the same class I get a memory access violation. For example: // this is fine, no error void CBase::FuncA( void ) { plugin_info_t *plugin_info = new plugin_info_t;
8
2835
by: JustSomeGuy | last post by:
I need to write an new class derived from the list class. This class stores data in the list to the disk if an object that is added to the list is over 1K in size. What methods of the std stl list class must Ioverride in order for this to work?
3
2140
by: Jef Driesen | last post by:
The number of items in my std::list is changed after sorting (using std::list member function sort). I'm using MSVC6 and the actual (pseudo) code is posted below. The output from size() is different before and after the sort. If I remove the sorting (and nothing else), both numbers remain the same. int nmerged = 0; do { std::list<mum_pair> mregions;
25
3865
by: Markus Svilans | last post by:
Hi, There seems to be some functionality missing from the STL. I am iterating through a linked list (std::list) using a reverse iterator and attempting to erase certain items from the list. It is important that I iterate through the list backwards, because the items in it have to be processed in reverse order before erasing. However, there does not appear to be an std::list::erase() method defined for reverse iterators.
7
2972
by: alex221 | last post by:
In need to implement a tree structure in which every node has arbitrary number of children the following code has come into mind: using std::list; template < class Contents class Tree_node{ Contents cn; list < BTree_node < Contents children; ........
7
2345
by: TBass | last post by:
So I have a class: class Client { unsigned int ClientID; .... }; class MyListenSocket
4
3894
by: TBass | last post by:
Hi, I've got a class that uses a std::list to store tags that need to be written out to a device. I've had no problem with the lists in terms of iterating and reading values. My problem is when I need to pop that value off the list when I'm done with it. In this case, I think the iterator is getting "lost" because I pop off the value it is pointing to at the end of this function. But how do I pop values off one at a time without the...
3
2523
by: Ray D. | last post by:
Hey all, I'm trying to pass a list into a function to edit it but when I compile using g++ I continue to get the following error: maintainNeighbors.cpp:104: error: invalid initialization of non-const reference of type 'std::list<HostID, std::allocator<HostID&' from a temporary of type 'std::list<HostID, std::allocator<HostID*' helpers.cpp:99: error: in passing argument 1 of `void
12
2698
by: isliguezze | last post by:
template <class T> class List { public: List(); List(const List&); List(int, const T&); void push_back(const T &); void push_front(const T &); void pop_back();
0
8676
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
9161
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9029
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
8897
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
7732
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
6522
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
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
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

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.