[REBOL] Re: Understanding tcp
From: patrick:philipot:laposte at: 16-Aug-2003 12:28
Hi Maarten, Gabriele, and Norman
Thanks to you, it works now.
I needed the open/no-wait !
So now, I am trying to put all this in a 'scheme.
It works pretty well but for the no-wait part.
The scheme is very short:
make root-protocol [
scheme: 'dbtcp
port-id: 3000
port-flags: system/standard/port-flags/pass-thru
open-check: none
open: func [port [port!] /local connection-string][
open-proto port
port/sub-port/state/flags: 524835 ; force /direct/binary mode
connection-string: system/words/copy
^(05)^(00)^(0A)^(00)^(00)^(01)
if not none? port/target [ append connection-string join "DSN="
port/target ";" ] ]
if not none? port/user [ append connection-string join "UID="
port/user ";" ] ]
if not none? port/pass [ append connection-string join "PWD="
port/pass ";" ] ]
insert port connection-string
]
insert: function [ port data ] [ ] [
system/words/insert port/sub-port data
]
copy: func [ port ] [
make string! system/words/copy port/sub-port
]
net-utils/net-install dbtcp self 3000
]
The test program is very short too.
Rebol[]
trace/net on
do %dbtcp-scheme.r
db: open dbtcp://localhost/mytest
insert db rejoin ["^(05)^(00)^(17)^(00)^(00)^(02)" "select * from mytable"
^(0D)^(0A)
]
insert db "^(05)^(00)^(0B)^(00)^(00)^(06)FetchRecord"
print mold copy db ; <<<<<<<<<<<<<< TIMEOUT ERROR
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
close db
I can tell that all this work pretty well because tcpview shows a correct
trace.
The server is receiving and sending its data.
However, as before, I am not in no-wait mode.
And so the copy fails.
I have looked deeply in the code of all existing protocols but found
nothing..
Does anybody have a clue?
Regards
Patrick