* This is the Client Application.
* This does all of the work.  It gets all of the variables both
* from the DBF in the Server application and from the memory
* variables in the Server application.

STORE SECONDS() TO MSEC
STORE .F. TO ContactMade
? "Trying to establish contact with DDESAMP.DBF...."
DO WHILE SECONDS()-MSEC<10 && try to contact the DBF for 10 SECONDS
   TALK TO DDESERVE ABOUT DDESAMP		&& Setup the link
   IF CONTACT()							&& if we made contact
     STORE .T. TO ContactMade
     ?
     ? "Contact established..."
     EXIT
   ENDIF
   CHKEVENT()				&& always check for any events
ENDDO
IF .not. ContactMade		&& contact not established--give up
   ?
   ? "CONTACT WAS NEVER MADE WITH THE DBF!"
   WAIT
ELSE     && If we get to this point, we have made contact
   EXECUTE "GO TOP"			&& execute this command in the server app.
   STORE REQUEST("FIELD1") TO VAR1   && get data
   STORE REQUEST("FIELD2") TO VAR2
   STORE REQUEST("FIELD3") to VAR3
   ?
   ? "FIELD 1 DATA (Character Field): "
   ?? VAR1
   ? "FIELD 2 DATA (Date Field): "
   ?? VAR2
   ? "FIELD 3 DATA (Numeric Field): "
   ?? alltrim(VAR3)
   EXECUTE "SKIP"         && go to the next record in DDESAMP
   STORE REQUEST("FIELD1") TO VAR4			&& get more data
   STORE CTOD(REQUEST("FIELD2")) TO VAR5
   ?
   ? "FIELD 1 DATA FROM RECORD 2 (Character Field): "
   ?? VAR4
   ? "FIELD 2 DATA FROM RECORD 2 (Date Field): "
   ?? VAR5
   TERMINATE			&& cut the link
ENDIF

STORE SECONDS() TO MSEC
STORE .F. TO ContactMade
?
? "Trying to establish contact with MEMORY..."
DO WHILE SECONDS()-MSEC<10 && Try to contact MEMORY for 10 SECONDS
   TALK TO DDESERVE ABOUT MEMORY		&& setup the link
   IF CONTACT()							&& check for contact
     STORE .T. TO ContactMade
     ?
     ? "Contact established..."
     EXIT
   ENDIF
   CHKEVENT()					&& always check for windows events
ENDDO
IF .not. ContactMade			&& contact not made
   ?
   ? "CONTACT WAS NEVER MADE WITH MEMORY!"
   WAIT
ELSE     && If we get to this point, we have made contact
   STORE VAL(REQUEST("RECORDNO")) TO VAR6		&& get data
   STORE REQUEST("CHARVAR") TO VAR7
   ?
   ? "NUMERIC VARIABLE: "
   ?? alltrim(str(VAR6))
   ? "CHARACTER VARIABLE: "
   ?? VAR7
   TERMINATE					&& cut the link
ENDIF

WAIT "DONE!!!"