dcantera
27-05-2008, 06:19
here is a task that I have been playing with and it was the point of my search for a basic interpretor/compiler.
a UDP listener
there wasn't enough docs/examples for me to do it on my own... here is what I have so far.
Uses "INet" '---Load INet module
Uses "RAS" '---Load RAS module
Uses "FILE" '---Load FILE module
Uses "TCPUDP" '---Load TCPUDP module
Uses "OS" '---Load OS module
Uses "CONSOLE" '---Load CONSOLE module
DIM pbxip AS LONG
DIM pbxname AS STRING
DIM udpconnid AS LONG
pbxip = HOSTNAME_TOIP("pbv01")
pbxname = HOSTIP_TONAME(pbxip)
Msg = "pbxip=" + pbxip + $CRLF
Msg += "pbxname=" + pbxname + $CRLF
MSGBOX(1,Msg)
udpconnid = UDP_Open(9009,UDP_FreeFile)
Do
INCR Count
sBuffer = UDP_Recv(udpconnid)
Msg = sBuffer
IF (Len(Msg) < 3) THEN
Msg = "hello"
END IF
MSGBOX(1,Msg)
Console_WriteLine Msg
Loop While ((Len(sBuffer) > 0) AND (ERR = 0))
UDP_Close(udpconnid)
a UDP listener
there wasn't enough docs/examples for me to do it on my own... here is what I have so far.
Uses "INet" '---Load INet module
Uses "RAS" '---Load RAS module
Uses "FILE" '---Load FILE module
Uses "TCPUDP" '---Load TCPUDP module
Uses "OS" '---Load OS module
Uses "CONSOLE" '---Load CONSOLE module
DIM pbxip AS LONG
DIM pbxname AS STRING
DIM udpconnid AS LONG
pbxip = HOSTNAME_TOIP("pbv01")
pbxname = HOSTIP_TONAME(pbxip)
Msg = "pbxip=" + pbxip + $CRLF
Msg += "pbxname=" + pbxname + $CRLF
MSGBOX(1,Msg)
udpconnid = UDP_Open(9009,UDP_FreeFile)
Do
INCR Count
sBuffer = UDP_Recv(udpconnid)
Msg = sBuffer
IF (Len(Msg) < 3) THEN
Msg = "hello"
END IF
MSGBOX(1,Msg)
Console_WriteLine Msg
Loop While ((Len(sBuffer) > 0) AND (ERR = 0))
UDP_Close(udpconnid)