DataBasic Reference > Statements and Intrinsic Functions > D > DISCONNECT Statement

Comment on this topic

Documentation Comments

Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.

RealityV15.1Online Documentation (MoTW) Revision 7

DISCONNECT Statement (DataBasic) (m618703+disconnect_s.htm)

To

Reality

Version

Topic

Submitted by

Company

Location

Email address

Comment

 

 

DISCONNECT Statement

Terminates a network session.

Syntax

DISCONNECT session {SETTING error} [THEN statement(s) | ELSE statement(s)]

Syntax Elements

session is a variable defined by ACCEPT and CONNECT statements identifying the session to which connection is presently made and from which the disconnect is to be made.

error is a variable that is assigned an error code number according to any errors detected if the ELSE clause is taken. If the ELSE clause is not taken, the value of error is set to 0. The error codes and corresponding messages are given in File I/O and IPC Error Codes.

statement(s) is either a THEN or ELSE clause (or both). A statement must be included. The THEN clause is executed if the DISCONNECT is successful. The ELSE clause is executed otherwise.

Operation

The DISCONNECT statement must be executed by both the client and server programs to clear the circuit at both ends.

If one program executes a DISCONNECT statement, the other program receives an error code when executing a SEND, RECEIVE, or RECWAIT command.

Example

ENDIT: *
DISCONNECT SESS SETTING ERVAL THEN...
STOP ELSE
BEGIN CASE
CASE ERVAL=nn; * Do something
*
*
END CASE
END
GOTO ENDIT

Disconnects from a session called SESS. If the disconnection is made, the program is terminated. If an error condition is received, the error code is assigned to variable ERVAL and the program evaluates the error code and takes appropriate action. The program then returns to the ENDIT label and attempts the DISCONNECT statement again.

RealityV15.1 (MoTW) Revision 7Comment on this topic