473,383 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Am I doing this right?

I have an simple app that pulls UDP socket packets off a network, places
that packet data in a structure, and places the structure into a vb.net
Queue (use enqueue. and dequeue). Writes queue to SQL server
In the form I have global decl.
PUBLIC DataQueue as NEW QUEUE
PUBLIC STRUCTURE myDataStruct (add some elements)

In my ONRECEIVEI place the buffer data into myDataStruct and
DataQueue.Enqueue(myDataStruct).

I also have a 100ms timer that does this:
dim tmpStruct as NEW myDataStruct
tmpStruct = DataQueue.Dequeue()
write tmpStruct to SQL
I've got a bool flag in the timer routine to keep it from running again
until it finishes everthing

Is there any kind of conflict that can occur here?
If OnReceive fires and enqueues while timer is dequeueing?
Some sort of deadlock???
I debug.writeline when enqueueing to assure what goes in the queue, but
sometimes when I dequeue the data it has a value from another packet
(scrambled), though the enqueue showed fine. Happens rarely but does happen.
I don't quite understand how the OS executes the code, reading and writing
at what 'I guess' is the same time to that queue sometimes.
Is the scenerio above OK to use or is there a better solution (more stable)
than what I am doing?
Thanks
BUC

Aug 15 '06 #1
3 1357
Hello Buc,

Is there somereason you dont just push the data direct to the DB? What's
the Queue for?

-Boo
I have an simple app that pulls UDP socket packets off a network,
places
that packet data in a structure, and places the structure into a
vb.net
Queue (use enqueue. and dequeue). Writes queue to SQL server
In the form I have global decl.
PUBLIC DataQueue as NEW QUEUE
PUBLIC STRUCTURE myDataStruct (add some elements)
In my ONRECEIVEI place the buffer data into myDataStruct and
DataQueue.Enqueue(myDataStruct).

I also have a 100ms timer that does this:
dim tmpStruct as NEW myDataStruct
tmpStruct = DataQueue.Dequeue()
write tmpStruct to SQL
I've got a bool flag in the timer routine to keep it from running
again
until it finishes everthing
Is there any kind of conflict that can occur here?
If OnReceive fires and enqueues while timer is dequeueing?
Some sort of deadlock???
I debug.writeline when enqueueing to assure what goes in the queue,
but
sometimes when I dequeue the data it has a value from another packet
(scrambled), though the enqueue showed fine. Happens rarely but does
happen.
I don't quite understand how the OS executes the code, reading and
writing
at what 'I guess' is the same time to that queue sometimes.
Is the scenerio above OK to use or is there a better solution (more
stable)
than what I am doing?
Thanks
BUC

Aug 15 '06 #2
May want to look at synclock for the que.
--
Dennis in Houston
"Buc" wrote:
I have an simple app that pulls UDP socket packets off a network, places
that packet data in a structure, and places the structure into a vb.net
Queue (use enqueue. and dequeue). Writes queue to SQL server
In the form I have global decl.
PUBLIC DataQueue as NEW QUEUE
PUBLIC STRUCTURE myDataStruct (add some elements)

In my ONRECEIVEI place the buffer data into myDataStruct and
DataQueue.Enqueue(myDataStruct).

I also have a 100ms timer that does this:
dim tmpStruct as NEW myDataStruct
tmpStruct = DataQueue.Dequeue()
write tmpStruct to SQL
I've got a bool flag in the timer routine to keep it from running again
until it finishes everthing

Is there any kind of conflict that can occur here?
If OnReceive fires and enqueues while timer is dequeueing?
Some sort of deadlock???
I debug.writeline when enqueueing to assure what goes in the queue, but
sometimes when I dequeue the data it has a value from another packet
(scrambled), though the enqueue showed fine. Happens rarely but does happen.
I don't quite understand how the OS executes the code, reading and writing
at what 'I guess' is the same time to that queue sometimes.
Is the scenerio above OK to use or is there a better solution (more stable)
than what I am doing?
Thanks
BUC

Aug 15 '06 #3
buc
A Little History.. The DB has one table that gets the inserted packets and a
SQL Stored Proc gets the inserted data and places it in other table. The
capture table is PURGED Every night. The captured table gets very big each
day (spurt times)(10-100K) inserts (but purged at midnight)
Since App receives thousands of packets, as the DB gets larger, the inserts
slow down and it causes the .net receive socket to eventually PUKE if I did
a straight insert, so I immead. throw them in a queue where they can get
inserted fast as as SQL will let them. possible, leaving the receive socket
cleared.
Thanks BUC

<Bucwrote in message news:%2****************@TK2MSFTNGP04.phx.gbl...
>I have an simple app that pulls UDP socket packets off a network, places
that packet data in a structure, and places the structure into a vb.net
Queue (use enqueue. and dequeue). Writes queue to SQL server
In the form I have global decl.
PUBLIC DataQueue as NEW QUEUE
PUBLIC STRUCTURE myDataStruct (add some elements)

In my ONRECEIVEI place the buffer data into myDataStruct and
DataQueue.Enqueue(myDataStruct).

I also have a 100ms timer that does this:
dim tmpStruct as NEW myDataStruct
tmpStruct = DataQueue.Dequeue()
write tmpStruct to SQL
I've got a bool flag in the timer routine to keep it from running again
until it finishes everthing

Is there any kind of conflict that can occur here?
If OnReceive fires and enqueues while timer is dequeueing?
Some sort of deadlock???
I debug.writeline when enqueueing to assure what goes in the queue, but
sometimes when I dequeue the data it has a value from another packet
(scrambled), though the enqueue showed fine. Happens rarely but does
happen.
I don't quite understand how the OS executes the code, reading and writing
at what 'I guess' is the same time to that queue sometimes.
Is the scenerio above OK to use or is there a better solution (more
stable) than what I am doing?
Thanks
BUC

Aug 16 '06 #4

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

Similar topics

1
by: Viken Karaguesian | last post by:
Hello all, I'm taking a shot at table-less design, but I feel like I'm poking in the dark here. I decided to try and recreate the main page of a webiste that I run, www.sayatnova.com, using CSS...
11
by: Sims | last post by:
Hi, I have a function that looks something like .... void Function( std::string &oldval ) { int iSome_size = xxx; // get some size char *tmp = NULL; tmp = new char;
1
by: Chris Uwins | last post by:
Hi there, i know theres a number of ways I can achieve this but want to know the best, (but still quite simple). Up until a year ago I never used Access but have designed a few databases for...
7
by: Ed Jay | last post by:
Well, nobody in alt.html wants to answer this question, so I'll ask it here: I have a button and associated text in a container. When one clicks the button it brings up additional buttons and...
4
by: esebastian | last post by:
Hello Everyone, I would just like some advice to make sure i am doing what i want to do the right way because i don't think i am. I have a form that contains checkboxes. The checkboxes are...
0
by: Nightcrawler | last post by:
I hope this is the right group for this question. I recently started looking into AJAX and I am doing the following: I have a repeater (dummydata) that is bound to a datatable (Articles). Each...
4
by: Benoit Lefebvre | last post by:
Weird subject you will say.. I didn't know what to put in there.. Long story short, I'm changing the value of a variable from a function.. Nothing unusual there.. How come the value of the...
14
by: jmDesktop | last post by:
I have a food menu. Each area, like beverages, grill, etc. have items under them, Coke, Tea, Coffee would be under beverages for example. I want to add a new drink to beverages. In my database...
6
by: r035198x | last post by:
I have put together this article to give people starting Swing an awareness of issues that need to be considered when creating a Swing application. Most of the Swing tutorials that I have seen just...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.