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

[REBOL] Re: retrieving data from TCP port

From: gscottjones:mchsi at: 22-Oct-2002 5:54

Hi, Francois, From: Francois Prowse
> hmmm, all looks good to me...however > > >> result: copy port > ** Access Error: Network timeout > ** Where: halt-view > ** Near: result: copy port > >>
Bummer.
> I'll have to fire up tcpdump and see if data is > really comming back in....either that or adjust the > time outs.
May not be a need to fire up tcpdump nor adjust the time outs. My program samples suffer from not being able to test a nd adjust. Of course, if you want to fire up tcpdump, then fire away! :-)
> What does copy wait for before terminating/closing the port
I may not be able to provide the best answer to this question. Basically copy is waiting for a none to be returned, but in my first example, it tried to read the response in one chunk, didn't receive the right signal. So copy stalls on the port. Everything stays open, and finally the network connection times out. I suspect a tcp/port-ologist could give a much better answer (in fact my dog on a bad day could probably give a better answer ;-). What we need is the no-wait refinement and loop that will catch fragments until the port finally returns a none (I have never figured out how anything can "receive" a "none"; I guess it is like the sound of one hand clapping. ;-) Try this variation: initial: read %initial.xml port: open/no-wait tcp://x.x.x.x:3221 insert port initial fragment: copy "" result: copy "" while [ wait port fragment: copy port ] [append result fragment] close port either find result "</rpc-reply>" [ print "success!!" ][ print "ooh, got an error..." ] If that doesn't work, then, yes, I would be happy to try a direct connection to a machine of your choosing. My guess is that the server might be line oriented, and that adding a /lines refinement would help. Again, just a guess... Good luck! --Scott Jones