Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Getting a response every 15 sec

Hello Guys,
I've created a communication application using TcpClient (a console application using C#).
It's working correctly, but I need the server TcpClient application send me a message every 15 seconds.
How can I tell the server application to send a message to the client application every 15sec ?
Does anybody have simple sample code that could show me how to do it ?

Thank you all
[423 byte] By [Michael] at [2007-11-11 10:06:24]
# 1 Re: Getting a response every 15 sec
You will want to look into using the Timer component. It's a very simple to use component that fires an event every x number of milliseconds.

Here's an example of how to work with timers:

http://abstractvb.com/code.asp?A=1032

It's a windows forms application, but it should give you the idea.
waterjock2000 at 2007-11-11 20:48:35 >
# 2 Re: Getting a response every 15 sec
Thank you for the advice, in fact I will use timers.
I also would like to know how can I send messages to the TcpClient SERVER application from a TcpClient CLIENT application ?
I need my CLIENTcation to receive messages from the SERVER application, but I must allow users to send messages to the SERVER too.
Do you know how can I do it ?
Michael at 2007-11-11 20:49:35 >
# 3 Re: Getting a response every 15 sec
Take a look at this sample:
http://www.dotnet247.com/247reference/articles/0/1218.aspx

It's a TcpIp based multi user chat system. It should help you flush out any learning curve with sockets in .NET
waterjock2000 at 2007-11-11 20:50:39 >
# 4 Re: Getting a response every 15 sec
Thank you both, very very much!
This article was very helpful !

Thank you !
Michael at 2007-11-11 20:51:40 >