Datasheet
if(len_ = 0) then ' what do to by default
len_ = putConstString(@httpHeader) ' HTTP header
len_ = len_ + putConstString(@httpMimeTypeHTML) ' with HTML
MIME type
len_ = len_ + putConstString(@indexPage) ' HTML page first part
len_ = len_ + putConstString(@indexPage2) ' HTML page
second part
end if
result = len_ ' return to the library with the
number of bytes to transmit
end sub
' *
' * this sub function is called by the library
' * the user accesses to the UDP request by successive calls to
SPI_Ethernet_getByte()
' * the user puts data in the transmit buffer by successive calls to
SPI_Ethernet_putByte()
' * the sub function must return the length in bytes of the UDP reply,
or 0 if nothing to transmit
' *
' * if you don"t need to reply to UDP requests,
' * just define this sub function with a return(0) as single state-
ment
' *
' *
sub function Spi_Ethernet_UserUDP(dim byref remoteHost as byte[4],
dim remotePort, destPort, reqLength
as word) as word
dim len_ as word ' my reply length
ptr as ^byte ' pointer to the dynamic buffer
tmp as string[5]
' reply is made of the remote host IP address in human readable
format
byteToStr(remoteHost[0], dyna) ' first IP address byte
dyna[3] = "."
byteToStr(remoteHost[1], tmp) ' second
dyna[4] = tmp[0]
dyna[5] = tmp[1]
dyna[6] = tmp[2]
dyna[7] = "."
byteToStr(remoteHost[2], tmp) ' second
dyna[8] = tmp[0]
dyna[9] = tmp[1]
dyna[10] = tmp[2]
dyna[11] = "."
387
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6