Sockets

Bob Sneidar bobsneidar at iotecdigital.com
Fri Oct 16 18:56:11 EDT 2015


use open socket then read from socket with message [callbackmessage]. In your [callback message] handler the it variable will contain the read data. If you don't use the with message form, you run the risk of exceeding the time set in the socketTimeoutInterval, at which point it will return the data read up until that point. 

I got all that just reading the dictionary, so I hope I got all that right. 

Bob S


> On Oct 16, 2015, at 13:44 , Eric Corbett <eric at canelasoftware.com> wrote:
> 
> I’ve read all the documentation and posts I can find and something still confuses me about sockets…
> 
> Server computer accept connections on port 12345 with message “readSocket”
> 
> Client opens socket IP:12345
> Client writes to socket IP:12345
> 
> Server reads message from client:
> 
> 	on readSocket pAddress, pMsg…
> 
> pAddress in this case does not contain IP:12345, but IP:[some unique id]
> 
> My question is how do I send a message back to the client on IP:[some unique id]?
> What does the client have to do to read messages coming back?
> 
> If I need to send messages back and forth, I have always created a server on both sides. According to docs, this should not be necessary. I don’t know how to open a single socket and send messages back and forth.
> 
> Bonus: How do I use the "|[connection id]”? I use an id for open socket and write to, but the address from the readSocket callback does not contain an ID. Is this a bug? I use write to… with message… and this handler has the ID as part of the address, but what use is it for the client if the server does not get it?
> 
> I’ve been using sockets for years, but still feel thoroughly ignorant.
> 
> Thanks,
> 
> Eric
> _______________________________________________
> 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