Results 1 to 3 of 3

Thread: UDP listener script

  1. #1
    Junior Member
    Join Date
    May 2008
    Posts
    6
    Rep Power
    17

    UDP listener script

    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.

    [code=thinbasic] 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)
    [/code]

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10

    Re: UDP listener script

    Dave,

    thanks for this script.
    I include to this post an old example I have made with Petr. It is a simple console chatting. Maybe it can help others. Just open the script into different computers and exchange each other IPs.

    Ciao
    Eros
    Attached Files Attached Files
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  3. #3
    Junior Member
    Join Date
    May 2008
    Posts
    6
    Rep Power
    17

    Re: UDP listener script

    way cool!...
    this gives me more info to accomplish my listener tool project.
    I really like the simplicity of thinbasic. it is a really cool tool for my toolbox.
    thanks,
    daveC

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •