this is a question on how to design an TCP Listener application.
background:
There will be several threads that listen on several ports (one per port).
when another app requests to connect, the connection will be accepted. then
messages will be received and passed to the main thread via a delegate or
event for processing. Messages will also be sent in return to the other
application in an asynchronous manner.

Questions:
1) from what it seems to me, delegates are thread safe but events are not.
is this true? should i use delegates to call back to the main thread rather
than events?

2) what is a clean way to have the main thread pass a message to a listener
thread to write messages? (a reverse call back)

thanks for your help
m

Re: TCP/IP app Desgin Question by Warnat

Warnat
Tue Nov 18 07:23:25 CST 2003

> There will be several threads that listen on several ports (one per port).
> when another app requests to connect, the connection will be accepted.
then
> messages will be received and passed to the main thread via a delegate or
> event for processing. Messages will also be sent in return to the other
> application in an asynchronous manner.

So, you have one/more listening socket.
In your accept-callback-method you get a new instan