Truus DXP-Server

Discussion about development of draughts in the time of computer and Internet.
Post Reply
Ed Gilbert
Posts: 859
Joined: Sat Apr 28, 2007 14:53
Real name: Ed Gilbert
Location: Morristown, NJ USA
Contact:

Post by Ed Gilbert » Wed Oct 21, 2009 14:12

I added a chat message sent from the server, but I am having a problem with it in kingsrow. The chat message is being sent immediately after the DXP_MOVE message, and it seems that this message is not always being cleanly delivered to kr from the dxp.dll function dxp_receive_message(). Sometimes the chat message is not received at all, and sometimes it seems to be corrupted with a MOVE message appended at the end of the CHAT text. After one of these events, the match is stuck because kr missed a move and waits indefinitely for the next move. I tried a few experiments and found that if I pace the messages being sent by the server so that there is at least a 100msec separation between a MOVE message and its following CHAT, then things work correctly. I also discovered that Dam2.2 does not have this problem with the rapid CHAT messages, and I know that Harm wrote his own dxp message handler rather than use Frank's dll. So I am suspecting a problem in the dll, as it is difficult to see how anything done outside of the dll could result in receiving corrupted messages. The dll uses a separate thread to receive socket messages, so even if I let several messages queue up before reading them I expect that to behave correctly. My main window message handler does in fact sometimes become busy for periods of up to perhaps 200msec before it returns to the GetMessage/DispatchMessage loop, so that could cause a couple of dxp messages to arrive before I read the first one.

I expect that when doing a socket recv(), it is possible that one might only receive part of a dxp message, or it could also receive one message plus part or all of a second message, so the code should be prepared for that and buffer the message contents appropriately, but maybe that is not happening? Harm, if you're following this, perhaps you could comment on how you handle data received from the socket in Dam2.2.

-- Ed

Harm Jetten
Posts: 43
Joined: Thu Sep 24, 2009 18:17

Post by Harm Jetten » Sat Oct 24, 2009 15:44

Hi Ed,

The TCP protocol is stream-oriented, meaning that recv() may yield a part of the message at a time, or more than a message. The message boundaries as intended by the sender must be made explicit by using e.g. an endcode such as a NUL character in the case of DXP.
In Dam 2.2 I append the result of each recv() to a buffer. If there is a complete message present including endcode, I process the message, remove it by shifting the buffer contents, and repeat the process until no endcode is found.

Harm.

Ed Gilbert
Posts: 859
Joined: Sat Apr 28, 2007 14:53
Real name: Ed Gilbert
Location: Morristown, NJ USA
Contact:

Re: Truus DXP-Server

Post by Ed Gilbert » Wed Dec 23, 2009 14:16

I added a chat message sent from the server, but I am having a problem with it in kingsrow. The chat message is being sent immediately after the DXP_MOVE message, and it seems that this message is not always being cleanly delivered to kr from the dxp.dll function dxp_receive_message(). Sometimes the chat message is not received at all, and sometimes it seems to be corrupted with a MOVE message appended at the end of the CHAT text. After one of these events, the match is stuck because kr missed a move and waits indefinitely for the next move.

I found the problem. There is a bug in the dxp.dll. It does not correctly handle the case where more than one dxp message is returned by a single call to the socket recv(). In a typical dxp engine match this does not occur because of the command/response nature of the dxp protocol, where each client message is normally answered by a response from the server, so neither side sends two messages in rapid sequence without an intervening message from the remote program. However DXP_CHAT messages are asynchronous and can occur anywhere. The truus dxp server is sending a chat message immediately after every DXP_MOVE message, and because of the Nagle algorithm the two messages are combined and sent in one data packet.

I wrote my own drop-in replacement for the dxp library functions, and when I use this code the match runs without errors.

Gerard, I don't know if you've added dam exchange to damy yet, but I have some dxp client/server test code that you might find useful. It's a small project that implements both a client and server that communicate using dxp messages. I used it to test my dxp library and verify the bug in Frank's dxp.dll. It's an example of how to integrate dam exchange into a windows program, and it includes the source to the dxp library functions.

-- Ed

BertTuyt
Posts: 1592
Joined: Wed Sep 01, 2004 19:42

Re: Truus DXP-Server

Post by BertTuyt » Mon Dec 28, 2009 14:26

When running the Truus DXP-server, i never see an immediate book-move from Truus in the beginning of the game (even when using settings like "Stel Openingsreportoire in"). So for an unknown reason the openingbook is not activated in my case (or at least I get this impression).

Am I the only one, or do other users of Truus see the same?
If others see immediate book moves, maybe they can help me what I need to change.

Anyway , another question for all .....
I would be interested to see the date of the openings.boe file ( 32 KByte) from some users here, the name implies that this file stores the openings-book.
However, im also quite sure that in this file the owner-name of the Truus program (you see it when you start the program in the clocks window) is stored (scrambled, so you wont recognize immediately).

Maybe Ed and I could update the Truus DXP server package with the option to change the owner-name in case you want to sell your legal copy to someone else, and you want to change this name to the new owner.

Bert

Ed Gilbert
Posts: 859
Joined: Sat Apr 28, 2007 14:53
Real name: Ed Gilbert
Location: Morristown, NJ USA
Contact:

Re: Truus DXP-Server

Post by Ed Gilbert » Mon Dec 28, 2009 15:26

When running the Truus DXP-server, i never see an immediate book-move from Truus in the beginning of the game (even when using settings like "Stel Openingsreportoire in"). So for an unknown reason the openingbook is not activated in my case (or at least I get this impression).
Bert, I have also noticed this, but it is not just when running dxp matches. I can never get truus to make moves from its opening book. I have asked a few other truus users about this and none of them know how to enable the opening book.

-- Ed

Ed Gilbert
Posts: 859
Joined: Sat Apr 28, 2007 14:53
Real name: Ed Gilbert
Location: Morristown, NJ USA
Contact:

Re: Truus DXP-Server

Post by Ed Gilbert » Mon Dec 28, 2009 15:31

I found the problem. There is a bug in the dxp.dll. It does not correctly handle the case where more than one dxp message is returned by a single call to the socket recv().
Frank has now fixed this bug and uploaded new dxp library files to his web site. http://www.mesander.nl/damexchange/edxpmain.htm

-- Ed

BertTuyt
Posts: 1592
Joined: Wed Sep 01, 2004 19:42

Re: Truus DXP-Server

Post by BertTuyt » Mon Dec 28, 2009 16:10

Ed, can you check the date of your opening.boe file.

If im right (and you believe in conspiracy theories), the openingbook is "on purpose" deactivated, if its now being used to store the program-owner name .

Maybe you can sent me your .boe file via Email, so I can check if my theory holds.......

Next to that I tried to activate the openingboe via the oa command (openingsboek aan) , (using the activated backdoor of Truus), but also so far this was not succesfull.
Im not sure if I already posted here, how one can activate the backdoor and with this, one has much more control options for the program.

Bert

BertTuyt
Posts: 1592
Joined: Wed Sep 01, 2004 19:42

Re: Truus DXP-Server

Post by BertTuyt » Sun Jan 03, 2010 21:42

So far I did not get a reply....
Therefor my question again.

In my case the TRUUS openingsbook does not seem to work, at least I dont get immediate answers.
Are there other TRUUS owners with the same problem, or am I the only one?

Bert

User avatar
FeikeBoomstra
Posts: 306
Joined: Mon Dec 19, 2005 16:48
Location: Emmen

Re: Truus DXP-Server

Post by FeikeBoomstra » Sun Jan 03, 2010 22:33

I am not getting immediate responses either.

Feike.

BertTuyt
Posts: 1592
Joined: Wed Sep 01, 2004 19:42

Re: Truus DXP-Server

Post by BertTuyt » Sun Jan 03, 2010 22:39

Feike, could you sent me your openings.boe file from TRUUS (32 kByte).
I want to check something.....
You have my email-address...

Bert

BertTuyt
Posts: 1592
Joined: Wed Sep 01, 2004 19:42

Re: Truus DXP-Server

Post by BertTuyt » Mon Jan 04, 2010 18:36

Thanks for those who have sent me some TRUUS openings.boe files.
I can now confirm (based on the tests done) that it is indeed this file where the TRUUS owner-name (person who bought the program) is stored.

I will dig into the differences of the files I recieved, and also will compare it with the older opening.boe file which is used with the (older) DOS version.
If im able to activate the openings book i will share it in this forum.

Next to that if succesfull, I will discuss with Ed if we could add this to the TRUUS DXP Server as a new feature.

Bert

BertTuyt
Posts: 1592
Joined: Wed Sep 01, 2004 19:42

Re: Truus DXP-Server

Post by BertTuyt » Thu Jan 07, 2010 01:44

I found a way to activate the TRUUS opening-book.
But it is (unfortunately) not straightforward.
I will discuss with Ed if it makes sense, and if it is possble, to implement the required "hooks" into the TRUUS DXP Server.

Bert

Ed Gilbert
Posts: 859
Joined: Sat Apr 28, 2007 14:53
Real name: Ed Gilbert
Location: Morristown, NJ USA
Contact:

Re: Truus DXP-Server

Post by Ed Gilbert » Fri Jan 08, 2010 00:12

Does the kndb still sell the truus program? I looked at their web site today and could not find it. I remember having a difficult time finding it the last time I looked, so maybe I'm overlooking it. I did a google search on the kndb domain and found this link to a file with prices: http://www.kndb.nl/cms/index.php?option ... oad&gid=54. But I saw no visible links to this file, so it might be obsolete.

-- Ed

BertTuyt
Posts: 1592
Joined: Wed Sep 01, 2004 19:42

Re: Truus DXP-Server

Post by BertTuyt » Fri Jan 08, 2010 00:36

Ed, this is what I found on the KNDB side:

Software voor Windows

135.00 Truus voor Windows, dam- en analyseversie
90.00 Truus voor Windows, upgrade van DOS naar Windows
110.00 Truus voor Windows, upgrade van DOS 1999 versie naar Windows

Bert

Ed Gilbert
Posts: 859
Joined: Sat Apr 28, 2007 14:53
Real name: Ed Gilbert
Location: Morristown, NJ USA
Contact:

Re: Truus DXP-Server

Post by Ed Gilbert » Fri Jan 08, 2010 01:43

Found it, thanks.

-- Ed

Post Reply