opened socket in IDE prevents script changes
matthias_livecode_150811 at m-r-d.de
matthias_livecode_150811 at m-r-d.de
Fri Jan 15 12:28:42 EST 2021
Thanks Alex.
I will keep your advice in mind.
Matthias
-
Matthias Rebbe
Life Is Too Short For Boring Code
> Am 15.01.2021 um 18:22 schrieb Alex Tweedly via use-livecode <use-livecode at lists.runrev.com>:
>
>
> On 15/01/2021 14:46, matthias rebbe via use-livecode wrote:
>> Alex,
>> for a new project which should include socket communication i have to prototype a short "demo" and i was already wondering if i need to have running 2 instances of the LC IDE for development.
>>
>> But now you wrote that you had one server and even multiple client stacks opened in LC.
>> So do i understand it correctly that both, server and client stack, can communicate with each other using sockets in one instance of the LC IDE?
>
> Yes. A couple of cautions ...
>
> - make sure your handlers are carefully named
> I had a bad habit of using the same name (_gotpacket) each time I wrote a socket-handling stack,
> so I had 'open socket ... with message "_gotpacket" '
> and then I used the same name when I wrote the server !!
>
> - beware "resetall". In the server stack, I do something like
>
>> -- would usually do
>> -- resetAll
>> -- but this causes problems with testing when you have both a client
>> -- and a server within the IDE of Rev
>> -- so here we will only reset those opensockets which have no 'host' part
>> -- intending this to be the ones which we have a current 'accept'
>> repeat for each line tSock in the openSockets
>> if ":" is not in tSock then close socket tSock
>> end repeat
>>
> and in the client stacks I do the inverse (if ":" is in tSock ...). Note this is still a problem when you have multiple client stacks in the same IDE.
>
> Finally,
>
> - when in doubt during testing - first reset the server, then the client.
>
>
> Good luck,
>
> Alex.
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list