SOCKET_WRITE Procedure

Writes data to a socket connection.

Usage

SOCKET_WRITE, connection, data 

Input Parameters

connection—A socket descriptor.

data—A byte array of data to write to the socket.

Keywords

None.

Discussion

This function can be used in both client and server programs. If used in a client program, it sends data to the server. If used in a server program, it sends data to the client.

All data written with this routine must first be converted to a byte array. For information on converting data to a byte array, refer to documentation on the BYTE and BYTEORDER functions.

Example

The following server program uses SOCKET_WRITE to send a string to a client. Note that the string is first converted to type byte.

PRO SERVER
   port = 1500
   socket = SOCKET_INIT(port)
   connection = SOCKET_ACCEPT(socket)
   data = BYTE('Server String ') 
   SOCKET_WRITE, connection, data
   SOCKET_CLOSE, connection
   SOCKET_CLOSE, socket 
END

See Also

SOCKET_READ

For more detailed information on using the socket routines, see the PV‑WAVE Application Developer’s Guide.