Sockets (again)

Bob Sneidar bobsneidar at iotecdigital.com
Tue Apr 4 16:47:25 EDT 2023


I have sockets working in my File Server Agent, but only using non-blocking calls, that is using "with message". Removing the "with message" bit does not return any response from the server agent. 

For instance I send a payload using 
write payload to socket tSocket with message "messageReceived" 
The messageReceived handler gets triggered, and I can then 
read from socket tSocket until EOF -- or other delimiter
it will then contain the response from the File Server Agent. 

If however I use 
write payload to socket tSocket -- blocking
read from socket tSocket until EOF -- or some other delimiter doesn't matter

the call times out and nothing ends up in the it or result variables. 

I can (and have) made the non-blocking method work, but that means I have to send all the files I want to transfer all at once, because if I send them one at a time, I need to know if the last transfer succeeded before continuing. 

Does anyone have an example of a blocking socket server? The example in Livecode Lessons really only focuses on non-blocking calls. 

Bob S




More information about the use-livecode mailing list