Matt:
Associated with each socket are large transmit and receive buffers. I do not know the exact size of these buffers, but I think they are around 10K each?
I am a bit confused about your 128 socket count. From what you said last, the Cobra would be the client, connecting to a PC which is the server. In this situation, I don’t see why you would have 128 sockets open. You should only use one socket between each device. Does the Cobra communicate to 128 PCs? Tell me a bit more about you application.
I don’t really know about different types of client/server structures. There are different protocols used, but the architecture is the same. A client calls the server to send and/or receive info. Generally, it is a multiple client to one server relationship, forgetting about load sharing configurations.
Generally it is not a good idea to have resources(sockets) sitting idle. But, if you had a source/client sending data every 10 seconds, you might want to keep the socket open. Every minute, maybe not. The decision has to be based upon your application and the available resources.
There is no asynchronous socket support with MF, so synchronous with threading is the way to go. Makes that decision easy. Or maybe not…
My typical design for a server is to have a thread which does the accepts for new calls/session. I don’t believe TCPListener is implemented on the MF. You will have to use the bind, listen and accept methods.
I instantiate a session object, which I build, which has a Start method which is passed the socket for the session. In the Start method I create a thread, which when it runs places a read on the socket. It can then receives messages from the client. The session object provides the context for the session.
When the client disconnects, which usually results in a completed read with a length of zero, the session closes the socket and terminates the thread.
And, you have to all of this while standing one one foot.