User manual

mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
497
dim txt as string[5]
result = 0
‘ reply is made of the remote host IP address in human readable format
byteToStr(remoteHost[0], dyna) ‘ rst IP address byte
dyna[3] = “.”
byteToStr(remoteHost[1], txt) ‘ second
dyna[4] = txt[0]
dyna[5] = txt[1]
dyna[6] = txt[2]
dyna[7] = “.”
byteToStr(remoteHost[2], txt) ‘ second
dyna[8] = txt[0]
dyna[9] = txt[1]
dyna[10] = txt[2]
dyna[11] = “.”
byteToStr(remoteHost[3], txt) ‘ second
dyna[12] = txt[0]
dyna[13] = txt[1]
dyna[14] = txt[2]
dyna[15] = “:” ‘ add separator
‘ then remote host port number
WordToStr(remotePort, txt)
dyna[16] = txt[0]
dyna[17] = txt[1]
dyna[18] = txt[2]
dyna[19] = txt[3]
dyna[20] = txt[4]
dyna[21] = “[“
WordToStr(destPort, txt)
dyna[22] = txt[0]
dyna[23] = txt[1]
dyna[24] = txt[2]
dyna[25] = txt[3]
dyna[26] = txt[4]
dyna[27] = “]”
dyna[28] = 0
‘ the total length of the request is the length of the dynamic string plus the
text of the request
result = 28 + reqLength
‘ puts the dynamic string into the transmit buffer
Spi_Ethernet_putBytes(@dyna, 28)
‘ then puts the request string converted into upper char into the transmit buffer
while(reqLength <> 0)
Spi_Ethernet_putByte(Spi_Ethernet_getByte())
reqLength = reqLength - 1
wend
‘ back to the library with the length of the UDP reply
end sub