From: Oliver A. <olli@3.1415926.org> - 2004-12-07 18:46:55
|
Hi CSRobots developers (well, the one that isn't me... ;) ), today I thought long and hard about how to implement the base class for CSRobot Orders and found a little problem. Orders can be divided into several ty<pes: - Orders which will only be sent to ther server without a response - Orders which will generate exactly one response - Orders with two or more response-objects from the server plus: - "responses" from the server without any orders - server pushing of som= e kind of information Our current scheme (send object the read object) is doing perfectly for the first two kinds, but dramatically fails with the latter two. The reason is: we currently have got a half-duplex connection to the server. The client can send data and the server can respond only after it receive= d an order. Thus, we need a full duplex connection to the server. The first idea I ha= d was establishing another half duplex connection to the server - this bear= s the same problems FTP does have and generally seems to be a bad idea. Fortunately Microsoft supplied us with the Socket.Select which seems to b= e a solution to the problem. So, my primary concern is: When we have a full duplex connection between client and server we have to cache data in buffers on both sides. We need an incoming and an outgoing queue for objects to send / objects that were received. These need to be synchronized as we will have one further threa= d (on both sides of communication) just for doing the communication. .NET provides Queue.Synchronitze() to get a synchronized handler for a Queue. Does this extension to our current model bear any risks I can't see? Olli --=20 My GPG / PGP key can be found at http://keyserver.veridis.com:11371/pks/lookup?op=3Dget&search=3D0xDAA8832= 3 |