Request for Assistance

  • Thread starter Thread starter Derek Martin
  • Start date Start date
D

Derek Martin

Hi there, I have a program that I am trying to deploy that checks a DB for
messages to a client every 15 seconds or so. If it finds one, it does some
stuff, then updates it in the DB as 'ACK.' I can't make it work for the
life of me and was wondering if someone would be so kind as to take a peak
at my code to offer some suggestions on 'best practice' for this type of
thing.

I am not averse to dumping the DB idea and going with some kind of port
listening, but just in general I need to be able to put a message somewhere
for a client that is then read in a sleeper process (without interupting the
rest of the program) and do stuff with that message.

Would someone be so kind? I don't want to attach the full source code of
the project here (30,000 ish lines), so if you could assist, just message
me.

Thanks!

Derek Martin
 
I'm afraid you aren't giving enough info here :/

w DB, how do you access it ...
Im not promesing much but if you send it over (w db if it's sql server or
some file ) i'll try to have a look at it tonight

just remove the rem stuff from my e-mail

eric
 
Hi Derek,

Describing your problem as you do, is I think more important than let us
look at your code in my opinion.

What you describe does sounds for me very much as multithreading process and
also a process that uses a timer, are you doing that?

Cor
 
Hi, Derek

first glimpse says me you are using one connection object between threads.
That's most likely reason for erratic behavior - whatever you have. I did
not look much further, though. You should have separate connection for each
thread - including UI.

HTH
Alex
 
Hi Derek,

Today I am not anymore in the opurtunity to look deeply at your code.

However it seems to me that you create an extra thread only to let it wait.
That is not necessary, to let the main thread wait without a timer is

threading.thread.sleep(15000) '

I think with knowing this a lot of things are easier, however that was the
part I did stop with checking your program.

When you want help, and not someone else did it already, message it than
again OK?
The day after tomorrow I have more time.

Cor
 
Thank you both for your posts! I don't understand what you are suggesting,
however.

Perhaps I should use a timer instead of a seperate thread? Also, I see that
I should use a seperate connection for each thread, that is easy enough to
do.

Which would yield better and more efficient results?
 
i know but didn't have the time yesterday and it seemed like a lot so ... :p
(+i don't have the newsgroup at home, thats all on my pc at work)

summary of w i said in mail
the nature of the problem lies more in the logical flow of the problem.
i fear it can never work like this becouse you will never know how long a
user keeps one of those messages open.
--> pick up on the event handlers of the messageprocessorclass (add a new
one on a timer/sleep if needed) and only show the next message when the
current one is dealth w

i think derek can try this and if he has more problems he can ask specific
questions now. (time will tell ;p)

eric
 
Hi Derek,

What I would do when I was you was trying to simplify some parts first to
create a good program flow.

I cannot test your program, however I thought I could a 4 or 5 deep
procedure call including thread, bring back to this, while that would in my
opinion should give no problems.

Private Sub main_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Do While True
process_client_messages()
Thread.CurrentThread.Sleep(15000)
Loop
End Sub

Cor
 
Back
Top