<<

Contents

Search

>>

 

CLIENT_SOCKET_READ$

 

 

Function

 

 

Syntax:

CLIENT_SOCKET_READ$(<Handle>,<Number of Characters>)

 

<Handle>

= <NUM-EXPRESSION>

<Number of Characters>

= <NUM-EXPRESSION>

 

 

Meaning:

This function reads data from a server socket and returns the read data as string.

 

If <Number of Characters> > 0 and no data are available CLIENT_SOCKET_READ$ return the empty String "".

 

If <Number of Characters> > 0 and data are available, then exactly <Number of Characters> characters are read. The function only returns after <Number of Characters> characters could be read.

 

If <Number of Characters> = 0 and data are available, a line is read, which means the line is read until a line end character is reached. The function only returns after a line could be read.

 

If <Number of Characters> = -1, the number of characters is returned which can be read.

 

If an error occurs, (e.g. Timeout), the variable ERRORTEXT$ contains the error report. If no error occurred, the variable ERRORTEXT$ contains the empty string "".

 

<Handle> is the identification number returned by the function CLIENT_SOCKET.

 

Parameter:

Handle

Handle of CLIENT_SOCKET

Number of Characters

Number of characters to read

 

Sample:

DATA$ = CLIENT_SOCKET_READ$(HANDLE%,NUMBER%)

IF NOT ISSPACE(ERRORTEXT$)

THEN ERRORMES = "Error " + ERRORTEXT$

ENDIF

 

See also:

CLIENT_SOCKET

CLIENT_SOCKET_SET_TIMEOUT

CLIENT_SOCKET_WRITE

CLOSE_SOCKET

SERVER_SOCKET