Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] no-wait for scheme

From: patrick:philipot:laposte at: 18-Aug-2003 9:45

Hi List, Previously on "Understanding tcp" My previous problem, while trying to code a Rebol Client, was that 'copy never returned any value.
>> serv: open/binary tcp://localhost:3000 >> 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
** Access Error: Network timeout ** Near: copy serv
>> close serv
Thanks to Maarten, Gabriele, and Norman, it is working now. The /no-wait refinement was needed in my case. My problem now is to use no-wait in a 'scheme. 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