473,732 Members | 2,146 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 1671

"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
3956
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
6807
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
2841
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
2141
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
3876
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
2973
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
2351
by: TBass | last post by:
So I have a class: class Client { unsigned int ClientID; .... }; class MyListenSocket
4
3898
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
2525
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
2707
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
8944
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
9306
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
9234
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
9180
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
6030
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
4548
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...
0
4805
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3259
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
3
2177
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.