View Full Version : TBHawkNL - Include and samples
Michael Hartlef
15-07-2007, 09:57
Hi folks,
on my trip of conversion I took my IBP HawkNL conversion and tried to bring it into thinBasic. That one sample I have works. The hard part was getting strings in and out, so other function declarations could be wrong. If you improve the header, then please post your new file.
Btw. HawkNL is a Network library that supports UDP and you can find it here:
http://www.hawksoft.com/hawknl/
Have fun
Michael
Edit: Updated the download with the sample fix of Eros.
Michael Hartlef
15-07-2007, 10:04
Before someone asks, this was more an eductional task for me. I think the native TCPUDP module will do the jobs great. I just wanted to see if I can get this thing here to work.
ErosOlmi
15-07-2007, 10:21
Mike,
first thanks!
Second I get a GPF, sorry. I get it here:
'(* list all the local addresses *)
console_writeline( "local addresses are:")
alladdr = nlGetAllLocalAddr(varptr(count))
'console_writeline("count:" & str$(count))
WHILE count > 0
retstr = nlAddrToString(alladdr, strptr(str2))
console_write( " " & PEEK$(ASCIIZ,retstr,255) & " -> ")
retstr = nlGetNameFromAddr(alladdr, strptr(str3))
console_writeline( PEEK$(ASCIIZ,retstr,255))
'console_writeline("alladdr->" & str$(alladdr))
alladdr = alladdr + LEN(addr)
'console_writeline("alladdr->" & str$(alladdr))
count = count - 1
wend
Count is equal to 3 (I have 2 lan plus one wireless) but I get printed only the first lan. Than GPF.
WHILE/WEND loop is executed but when restart, the second time it GPF in nlAddrToString function
Ciao
Eros
Before someone asks, this was more an eductional task for me. I think the native TCPUDP module will do the jobs great. I just wanted to see if I can get this thing here to work.
Mike thanks for the message in the quote. I would have been confused and wondering.
ErosOlmi
15-07-2007, 10:33
Mike,
I think I've found. Change from
dim retstr as ASCIIZ
to
dim retstr as dword
Because nlAddrToString in reality return a pointer to an ASCIIZ buffer and not an ASCIIZ. So it is a DWORD. An ASCIIZ string without a defined size in thinBasic is something more close to a dynamic string than a memory buffer.
Ciao
Eros
Michael Hartlef
15-07-2007, 10:35
Thanks EROS! I said, I had big time troubles with strings
ErosOlmi
15-07-2007, 10:47
Petr ???
;D
Michael Hartlef
15-07-2007, 10:56
Ok, Ok, I go back to bed. Sorry man!
ErosOlmi
15-07-2007, 12:29
In any case, thanks a lot for pointing me to this lib I didn't know. Seems very interesting having a low level net lib.
thinBasic TCP/UDP module is quite high level and hide the complexity of such task bringing to thinBasic user the easy part. But sometime someone wants more. So this lib seems very good. I have to read licence and see if I can add to thinBasic arsenal.
Thanks
Eros
Michael Hartlef
15-07-2007, 13:14
Sure, it would be nice to see some kind of things of it in the TCPUDP module. Did you saw the HawkVoice module?