beautypg.com

Admnet api receive socket functions – ProSoft Technology MVI69-ADMNET User Manual

Page 105

background image

MVI-ADMNET ♦ 'C' Programmable

WATTCP API Functions

'C' Programmable Application Development Module with Ethernet

Developer's Guide

ProSoft Technology, Inc.

Page 105 of 122

February 20, 2013

6.6

ADMNET API Receive Socket Functions

This section describes the ADMNET API Receive Socket functions.

sock_read

Syntax

int sock_read( sock_type *skType, byte *data, int len);

Parameters

skType

Socket that will be used to receive data.

data

Pointer to a buffer that contains data that is received.

len

Length of the data specified to receive.

Description
This function reads data from the socket being passed to the function. The
function will wait until the all the data is read.

Return Value
Number of Bytes that are read to the socket or -1 if an error occurs.

Example

sock_type *socket;
char theBuffer [512];
int len, bytes_receive;

. . .

bytes_receive = sock_read(socket, (byte*)theBuffer, len);

See Also
sock_fastread (page 106)