Sockets

Eric Corbett eric at canelasoftware.com
Fri Oct 16 16:44:56 EDT 2015


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



More information about the use-livecode mailing list