Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

timer problem

Status
Not open for further replies.

WebStar

Programmer
May 1, 2002
69
0
0
DE
Hi,
I have this problem:
I have a client-server aplication based on socket comunnication. What I want is that when the client recives a message from the server a timer to start. The problem is that is doesn't want to start.
If I place a messagebox to show when the message arives it works.
If I place the timer start at a push button event it works. So the event caused when arriving a message on the socket works and the timer works, then why the timer doesn't start when socket message arrives?
Thank you!
 
some code?

____________________________________________________
If you like a post, show you care by giving it a star.
 
I have the code at home where I don't have an Internet connection, but I'll try to get the more important part on a disk. The problem is the application is huge and I don't know what part do you need. The part where I want to start the timer is just calling the timer in a OnSocketMessage event. The timer start is is the only line in this event.
 
stick the timer start back in the event listener, then sandwich it with two Console.Writeline statements. make good use of the console here, get pleanty of info about the timer object and everything passed to the method you're in (probably and object called sender, and some EeventArgs called e). you should be looking for:

1) whether or not you see both outputs.

2) the differece between the outputs (in other words, changes to the objects).

3) any time delay between the outputs.

...and just anything alse you pick up on. get back with the results.

____________________________________________________
If you like a post, show you care by giving it a star.
 
Here is the event made by me:
private void OnSockMessage(object sender, SockEventArgs e)
{
if (e.SockMsg.StartsWith(&quot;<C>START&quot;))
{
timer_actualizare.Start();
...
}
}

OnSockMessage is declared as an event.

public event MessageDelegate OnSockMessage;

it seems that the timer starts on any system event but not on events raised by me. I tried &quot;sandwiching&quot; the timer start between 2 console.writeline and the answer is right:
private void OnSockMessage(object sender, SockEventArgs e)
{
if (e.SockMsg.StartsWith(&quot;<C>START&quot;))
{
Console.WriteLine(&quot;Before timer starts &quot;+DateTime.Now.ToString() + &quot;:&quot; + DateTime.Now.Second.ToString());
timer_actualizare.Start();
Console.WriteLine(&quot;After timer starts &quot;+DateTime.Now.ToString() + &quot;:&quot; + DateTime.Now.Second.ToString());
}
}

Before timer starts 29.09.2003 21:22:17:17
After timer starts 29.09.2003 21:22:18:18

so the console.writeline works but the timer woun't start.. Any suggestions??? Please tell me if you want me to provide you with more info. Thank you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top