My app is an internet chess app. To avoid having to create and maintain a dedicated server on a dedicated machine, I have placed both TIDTCPClient and TIDTCPServer components on a
single form.
WHAT WORKS…
Note: My peer-to-peer system uses the terms “Host” and “Guest’.
My app has “Go Online” and “Get Online Members” processes. “Go Online” sends an email with
an encrypted subject containing user data, plus the user app’s server’s external IP address and port to a dedicated “GMail” account.
The subject looks like this…”ᄚᄈトᆲ゙メ쩨ᅩᅩ효ᅪ쾌쿄ᅨ토ᅬツᆲ゙メフᄐラレフフᄍヘヨレムロフᅮᆲ゙メメニᅮᅩᅩᅧᅪᅨᅨᅪᅪᅮᅧᅬᅬ”.
“Get Online Members” retrieves emails post by other users who have “Gone Online”, decrypts the subject, parses the decrypted subject, displays “Club Name” and “User Name” in a string grid and saves the data in a parallel array of records. Both the string grid and array are zero-indexed.
When the Host clicks on the string grid…
- the app finds the corresponding record and the Host’s client connects to the Guest’s server.
- The Host clicks the “Send Invitation” button, sets the game time control in a dialog box, clicks “OK” and the invitation is sent via an encrypted TCP message to the Guest.
Note: The email contains the Host’s server’s external IP and port. - The Guest’s app server receives the message, decrypts the message, parses the decrypted message and the Guest client connects to the Host server, and responds to a “Accept/Decline” confirmation dialog.
The game moves…
Assume that the Host plays White and that the Guest accepted the invitation.
- The game begins with White’s server disconnecting the Guest’s client.
Note: The Host’s server remains active. Disconnecting the Guest’s client allows the server to stop listening - “White” makes their move and sends its move via a TCP message (not encrypted) to the Guest’s app server which was always active and listening.
- The Guest’s app server disconnects the Host’s client and reconnects its client to the Host server. Then, the Guest app parses the move (12 parts), executes the Host’s move on its board (updates the Guest’s board), (Black Guest) makes its own move, sends the move via TCP message to the Host app server, and the Guest app’s server waits for White’s next move.
THIS ALL WORKS.
However, if I “X Out” and close either app, the app generates a “System error. code: 400”
I have read several pages of reports of this error and still do not have a solution.
Can you help?
2