![]() |
| | #1 |
| Just one more wrong move. Join Date: Aug 2001
Posts: 3,232
| Multithreading Anyway, my code looks like this: Code: void startClick(object sender, System.EventArgs e)
{
server.Start();
Thread thread = new Thread(new ThreadStart(Listen));
}
public void Listen()
{
Socket accept;
while(true)
{ accept = server.AcceptSocket();
listBox.Items.Add(accept.RemoteEndPoint);
}
}
For some reason the thread is never generated, and the Listen() function is never called. Also, is working with asynchronous sockets any easier in C# if so, maybe I should just do that...
__________________ Gays can't love like real people entropysink.com -- because arses weren't designed for running websites. |
| -KEN- is offline | |
| | #2 |
| the hat of redundancy hat Join Date: Aug 2001 Location: Hannover, Germany
Posts: 2,769
| Your program is fine, I'm having the exact same lines in some of mine... you are just missing one line: Code: void startClick(object sender, System.EventArgs e)
{
server.Start();
Thread thread = new Thread(new ThreadStart(Listen));
thread.Start(); // !!! ;-)
}
public void Listen()
{
Socket accept;
while(true)
{
accept = server.AcceptSocket();
listBox.Items.Add(accept.RemoteEndPoint);
}
}
__________________ hth -nv She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate." When in doubt, read the FAQ. Then ask a smart question. |
| nvoigt is offline | |
| | #3 |
| Just one more wrong move. Join Date: Aug 2001
Posts: 3,232
| Talk about a "duh" moment. Nvoigt...don't take this the wrong way...but I think I love you .
__________________ Gays can't love like real people entropysink.com -- because arses weren't designed for running websites. |
| -KEN- is offline | |
| | #4 |
| ¡Amo fútbol! Join Date: Dec 2001
Posts: 2,123
| ::Joke so easy that it's omitted:: |
| golfinguy4 is offline | |
| | #5 |
| Registered User Join Date: Feb 2002 Location: Richmond, VA
Posts: 438
| Hey man, everybody has those moments. Only god knows how many times I've done stupid $$$$ like that. |
| CompiledMonkey is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multithreading (flag stopping a thread, ring buffer) volatile | ShwangShwing | C Programming | 3 | 05-19-2009 07:27 AM |
| multithreading in C++ | manzoor | C++ Programming | 19 | 11-28-2008 12:20 PM |
| Question on Multithreading | ronan_40060 | C Programming | 1 | 08-23-2006 07:58 AM |
| Client/Server and Multithreading | osal | Windows Programming | 2 | 07-17-2004 03:53 AM |
| Multithreading | JaWiB | Game Programming | 7 | 08-24-2003 09:28 PM |