Page 1 of 1

[C#] raise event at incomming connection?

Posted: Thu 11 Jan, 2007 5:52 pm
by King Harold
this Socket.listen works, but it also locks up - completely.
is there any way to make something raise an event that would come when 'listen' would have ended?
(probably, but how?)

Posted: Thu 11 Jan, 2007 6:02 pm
by benryves
It sounds like you need to implement an asynchronous client/server design rather than a synchronous one.

Socket Code Examples.
...The client is built with an asynchronous socket, so execution of the client application is not suspended while the server returns a response. ...
...The server is built with an asynchronous socket, so execution of the server application is not suspended while it waits for a connection from a client. ...

Posted: Thu 11 Jan, 2007 6:26 pm
by King Harold
oh yes, silly me :P
thanx a lot! :D

Posted: Thu 11 Jan, 2007 6:33 pm
by benryves
Incidentally, I thought you were looking to raise your own events within a class before reading your post. For that, this walkthrough has been useful to me.

Posted: Thu 11 Jan, 2007 7:09 pm
by King Harold
wow that's great! I always wondered how to do that!
thanx again! :D

Posted: Sat 13 Jan, 2007 12:05 pm
by King Harold
how do you find out the speed of the connection? if it is at all possible..
I had thought to send some test data and clock it, but it went all weird, so.. any tips?