Socket Comm Sequence Issue
Frank D. Engel, Jr.
fde101 at fjrhome.net
Fri Apr 15 15:00:18 EDT 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
If app 1 launches app 2, app 2 should initiate the conversation, since
app 1 should be ready to listen by the time it launches app 2, whereas
app 1 would not know how long it was going to take app 2 to reach the
point where it is listening.
On Apr 15, 2005, at 2:15 PM, Brian Yennie wrote:
>> When do you trigger "sendData"? When I put this into two stacks and
>> open
>> them, it puts them both into "accept" mode, but neither sends
>> anything to
>> the other.
>
> I was just triggering it from the message box, but it should work from
> anywhere once both stacks are open.
>
>> What I'm trying to accomplish is that App 1 launches, it in turn
>> launches
>> App 2, and both of them are in a two-way communication session...
>>
>> Any suggestions on scripting the critical "who talks first" step?
>> Because if
>> someone talks before the other one is listening, you're hosed...
>
> Well, if App 1 is launching App 2, wouldn't App 1 do the first talking?
>
> Why are you hosed? I guess that's the crux- it shouldn't hose anything
> (other than not being able to make the connection). Can you lower the
> socketTimeoutInterval and have App 1 keep trying after it launches app
> 2?
>
> Something like this maybe? The idea would be that either application
> would look for the other when it was launched. If it was able to
> connect, it knows it is application #2. Otherwise, if the connection
> times out, it is app #1 and it launches application #2. In turn, that
> second application should be able to connect back. If you set the
> timeout value low and make asynchronous calls, it should be pretty
> snappy.
>
> Is this along the right lines?
>
> global myAppNumber
>
> ## look for an existing application 1 and open our own listener
> on openStack
> lookForFirstApplication
> accept connections on port 9000 with message "gotConnect"
> end openStack
>
> ## try to connect to the other app
> on lookForFirstApplication
> set the socketTimeoutInterval to 5000
> open socket to port 8999 with message "foundApplication1"
> end lookForFirstApplication
>
> ## found it, we must be app #2.. we could safely start talking after
> this
> on foundApplication1 s
> close socket s
> put 2 into myAppNumber
> end foundApplication1
>
> ## couldn't connect, so we must be application #1
> ## now launch the second app, which will connect back to us
> on socketTimeout s
> close socket s
> put 1 into myAppNumber
> launchApplication2
> end socketTimeout
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
- -----------------------------------------------------------
Frank D. Engel, Jr. <fde101 at fjrhome.net>
$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten
Son, that whosoever believeth in him should not perish, but have
everlasting life.
$
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCYA9C7aqtWrR9cZoRAnl8AJ4jaw8T0Ivfm/a1AAdkSRb5PGA6dQCbBxPs
2/33xQlHEff1jO5InPffGNA=
=OGFU
-----END PGP SIGNATURE-----
___________________________________________________________
$0 Web Hosting with up to 200MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com
More information about the use-livecode
mailing list