Socket Comm Sequence Issue
Ken Ray
kray at sonsothunder.com
Fri Apr 15 23:03:42 EDT 2005
On 4/15/05 8:09 PM, "Alex Tweedly" <alex at tweedly.net> wrote:
> Ken Ray wrote:
>
>> I'm trying to get two apps to talk to each other over sockets on OS X, which
>> means that both apps need to be in "listening" mode as well as "speaking"
>> mode. The relevant code I'm using for testing this right now is shown below,
>> and doesn't trap for errors or messages that I'm not interested in:
>>
>>
> There have now been lots of replies with specific suggestions -
> hopefully Ken's now moving forward with his specific problem.
Alex, thanks for summarizing the options. I think the key to understanding
everything (which was made known by examining your TCP App 1 and TCP App 2
examples) is:
- The "listener" listens on a given port (like 6000)
- The "speaker" sends to that same port (6000)
- The "listener" then gets ANOTHER PORT for communication (like 51829)
... and then the main point:
From that point on, the apps are able to talk to each other, but on
DIFFERENT SOCKETS!! That is, the "listener" is reading and writing to the
port returned from 'accept' (51829), and the "speaker" is reading and
writing to the port that it opened to talk to the "listener" (6000).
My mistake was assuming that the two apps would communicate on the SAME port
and not different ones.
Thanks to you and everyone else who contributed to getting this through my
thick head...
:-D
Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com
More information about the use-livecode
mailing list