User guide

65
VTB USER GUIDE
PROTOCOL PROCESS FUNCTION
This function isn't defined by system but it must be written in the application. The system will call this function, by the
pointer passed with pxeth_add_prot, each time a data packet is received from the port associated to this protocol. To
read the received data the function pxeth_rx have to be call while to send the response data they must be written in
the transmit buffer (buftx) and return from the function the number of bytes we want to send.
Hardware NG35,NGMEVO
Syntax
PROCESS_MY_PROTOCOL(len as long, buftx as *char) as long
Parameters
len Length of data packet received
buftx Pointer to the transmit buffer
Return value
long Number of bytes to be send
Example
Used variables:
bufrx(100) char
'protocol process function
function my_protocol(len as long, buftx as *char) as long
dim i as int
for i=0 to i<len 'Read all received data
bufrx(i)=pxeth_rx()
next i
... 'Process the data
buftx(0)=12
buftx(1)=34
my_protocol=2 '2 will be sent as response
endfunction
PXETH_RX
Read a single byte from the TCP/IP receive buffer. It is called by the protocol process function to read the received
data.
Hardware NG35,NGMEVO
Syntax
PXETH_RX() as char
Return value
Char Data read from the receive buffer