[REBOL] Re: Understanding tcp
From: maarten:vrijheid at: 16-Aug-2003 7:46
OK, see below for some explanations.
> -----Original Message-----
> There is my Rebol code:
> >> serv: open/binary tcp://localhost:3000
Change this to open/binary/no-wait
> >> insert serv "^(05)^(00)^(0A)^(00)^(00)^(01)DSN=mytest;"
> >> insert serv "^(05)^(00)^(17)^(00)^(00)^(02)SELECT * from
> >> insert serv "^(05)^(00)^(0B)^(00)^(00)^(06)FetchRecord"
> >> copy serv
copy will now return either an empty binary/string or what's available.
So you'll need to do something like:
Buff: make binary! 2048
data: copy serv
if not empty? Data [ append buff data]
with finished-reading a function that checks to see if you have got all
data. This for example how the old Rugby does these things.
> >> close serv
> My guess is that I should use this number in some way.
> But I have looked everywhere for an example without success.
No, that's just some info you can forget. It is the number that is
assigned to the connection by the OS, but you are handed back (and are
only interested in).... the connection itself.