Datasheet

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;
result := len ; // return to the library with
the number of bytes to transmit
end;
{*
* this 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 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 function with a return(0) as single statement
*
*}
function SPI_Ethernet_UserUDP(var remoteHost : array[4] of byte;
remotePort, destPort, reqLength : word)
: word;
var len : word; // my reply length
ptr : ^byte; // pointer to the dynamic buffer
tmp : string[5];
begin
// 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] := '.' ;
byteToStr(remoteHost[3], tmp) ; // second
398
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6