Click here to Skip to main content
15,920,438 members
Home / Discussions / C#
   

C#

 
AnswerRe: Passive/Active listening server Pin
mikone10-Oct-06 0:01
mikone10-Oct-06 0:01 
In generally you solve this problem by using loops. Make a button "Start listening" which sets a bool variable, lets call it KeepListening, to true and call the listenfunction which contains a loop like

while (KeepListening)
{
// Put Receive-Code in here...
System.Threading.Thread.Sleep(10);
}

Now the second button sets the variable KeepListening to false. If you click it, the application will leave the loop.

If you want to make your application listen to incoming traffic and also being available for user inputs, you will have to use threads (create a listening thread).

There are nice threading-tutorials out there if you aren't familiar with threading at all. I'm too lazy/busy to search for a nice explanation but i will do if you are not successful.

Lets sum it up:
- You will have to use a Loop to listen all the time.
- You will have to make use of the multithreading if your application should be available for other tasks while listening.

Good luck,
mik Smile | :)
GeneralRe: Passive/Active listening server Pin
The underdog10-Oct-06 0:26
The underdog10-Oct-06 0:26 
GeneralRe: Passive/Active listening server Pin
mikone10-Oct-06 0:56
mikone10-Oct-06 0:56 
GeneralRe: Passive/Active listening server Pin
The underdog10-Oct-06 2:23
The underdog10-Oct-06 2:23 
GeneralRe: Passive/Active listening server [modified] Pin
mikone10-Oct-06 2:52
mikone10-Oct-06 2:52 
QuestionGarbage Collector Performence Pin
Mandaar Kulkarni9-Oct-06 22:57
Mandaar Kulkarni9-Oct-06 22:57 
AnswerRe: Garbage Collector Performence Pin
quiteSmart9-Oct-06 23:16
quiteSmart9-Oct-06 23:16 
AnswerRe: Garbage Collector Performence Pin
S. Senthil Kumar10-Oct-06 2:55
S. Senthil Kumar10-Oct-06 2:55 
QuestionTabPage Events do not fire w/ .Net1.1 Pin
Jeff Jordan9-Oct-06 22:21
Jeff Jordan9-Oct-06 22:21 
AnswerRe: TabPage Events do not fire w/ .Net1.1 Pin
quiteSmart9-Oct-06 22:46
quiteSmart9-Oct-06 22:46 
GeneralRe: TabPage Events do not fire w/ .Net1.1 Pin
Jeff Jordan9-Oct-06 23:06
Jeff Jordan9-Oct-06 23:06 
GeneralRe: TabPage Events do not fire w/ .Net1.1 Pin
mikone10-Oct-06 0:06
mikone10-Oct-06 0:06 
GeneralRe: TabPage Events do not fire w/ .Net1.1 Pin
Jeff Jordan10-Oct-06 0:15
Jeff Jordan10-Oct-06 0:15 
Questionisnumeric in c# Pin
Amar Chaudhary9-Oct-06 22:16
Amar Chaudhary9-Oct-06 22:16 
AnswerRe: isnumeric in c# Pin
mikone9-Oct-06 22:27
mikone9-Oct-06 22:27 
GeneralRe: isnumeric in c# Pin
Amar Chaudhary10-Oct-06 0:20
Amar Chaudhary10-Oct-06 0:20 
GeneralRe: isnumeric in c# Pin
Martin#10-Oct-06 1:58
Martin#10-Oct-06 1:58 
GeneralIve heard that before Pin
Ennis Ray Lynch, Jr.10-Oct-06 16:40
Ennis Ray Lynch, Jr.10-Oct-06 16:40 
GeneralOk checked the MSIL Pin
Ennis Ray Lynch, Jr.10-Oct-06 17:03
Ennis Ray Lynch, Jr.10-Oct-06 17:03 
AnswerRe: isnumeric in c# Pin
RanjithLogics9-Oct-06 22:32
RanjithLogics9-Oct-06 22:32 
GeneralRe: isnumeric in c# Pin
Amar Chaudhary10-Oct-06 0:17
Amar Chaudhary10-Oct-06 0:17 
GeneralRe: isnumeric in c# Pin
rah_sin10-Oct-06 0:29
professionalrah_sin10-Oct-06 0:29 
GeneralRe: isnumeric in c# Pin
ejuanpp10-Oct-06 2:35
ejuanpp10-Oct-06 2:35 
GeneralRe: isnumeric in c# Pin
RanjithLogics10-Oct-06 3:53
RanjithLogics10-Oct-06 3:53 
GeneralRe: isnumeric in c# Pin
J4amieC10-Oct-06 4:34
J4amieC10-Oct-06 4:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.