Reads data from a socket connection.
Before calling SOCKET_READ, you must initialize data to be a byte array of sufficient size to hold the data sent from the client. It is up to the programmer to convert the data in the byte array into whatever form the server or client expects to process. PV-WAVE provides several routines for converting data from one type to another, including BYTE, BYTEORDER, COMPLEX, DOUBLE, FLOAT, LONG, and STRING.
PRO CLIENT host = 'localhost' port = 1500 socket = SOCKET_CONNECT(host,port) IF socket EQ -1 OR socket EQ -2 THEN BEGIN PRINT, 'SOCKET_CONNECT failed with return code: ', socket RETURN ENDIF data = BYTARR(15) nbytes = SOCKET_READ(socket,data) PRINT, 'CLIENT received: ', STRING(data) SOCKET_CLOSE, socket ENDSee Also
For more detailed information on using the socket routines, see Interapplication Communication Using the Socket OPI.