OpenSockets and multiple stacks...?
alex at tweedly.net
Thu Oct 27 16:56:38 CDT 2005
John Patten wrote:
>Thanks List for all the good suggestions!
>The socket calls are all new to me, so I'm still digesting the examples in the user directory. I believe the idea of having student stacks subscribe/connect to the teachers stack by creating a connection and then collecting student (stack) IP makes sense. I'll work from that angle.
>I had a couple questions...
>- When the a stack makes a connection to another stack, does the socket number/ID stay with the stack connection for the duration of the connection?
>- What actions will terminate a connection between two stacks?
Primarily, either end doing a "close socket" (the other end will receive
a "socketClosed" message).
Can also terminate if either end crashes, or the app is closed down
without doing a "close socket" (in this case the other end will
(possibly ? or always ? not sure) get a "socketError" message; it may
get a socketTimeout first.
Can happen because of network failure (e.g. cable disconnected,
switch/router dies, wifi network fails, etc.
>- When testing scripts, it appears that Rev holds on to certain previous actions. For example, I have been going back and forth between pairs of stack examples from the user library, and my own. Throwing around open sockets, connections, etc. scripts and changing between stacks appears to mix things up a bit. Is there a command I can throw into the msg box, "purge memory?" , that would prevent me from quitting and relaunching Rev when I'm testing scripts?
But in some ways I found that just got in the way of testing, because it
would close down both client and server parts, which often I didn't
want. See the "reStart" handler (in the card script) in my TCP server
I did find it confusing to test networked apps in Rev, so at different
times I resorted to:
- using two machines
- using the Player for client and the IDE for the server
- building standalones for one side
- and for some testing I wrote one or other side in Python just to stop
me getting myself confused.
Two or more) machines is definitely best :-)
Alex Tweedly http://www.tweedly.net
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.361 / Virus Database: 267.12.5/149 - Release Date: 25/10/2005
More information about the use-livecode