Open Socket With Messages

Mike Bonner bonnmike at
Mon Jul 6 22:54:20 CEST 2015

Hmm. YOu might check socketError

Also, in 7.0.5, I just tried this in a button.

on mouseUp
   put "" into theSocket
   open secure socket to theSocket with message socketConnected
   wait for messages
   put  "HI!" & cr
end mouseUp
on socketConnected pSocket
   -- callBack for open socket commands
   put the openSockets into theOpenSockets
   put merge("Connected to socket: [[pSocket & cr]]") after msg
   close socket pSocket

   put merge("Socket [[pSocket]] now closed") after msg
end socketConnected

I left the "wait for messages" in just to test something.

Interestingly, the "HI!" is put into the message box first, which kinda
indicates another message is making it pop before the socketConnected

But I figure, moving the stuff that you don't want to run into the handler
specified using "with message" makes it so that it won't run until the
connection is complete anyway.  Having said that, no clue why its not
working for you, though I seem to recall Dr H having trouble with "secure"
connections in the past, and there having been a bug of some type.  What
version of LC are you using?

The dictionary does says the "wait for messages" form will trigger from any
message. And the way the message box is populated it seems to confirm.  HI
shows up, then "connected, then "disconnected"

On Mon, Jul 6, 2015 at 2:46 PM, Bob Sneidar <bobsneidar at>

> Out of curiosity, would having these handlers in a frontscript be a
> problem?
> Bob S
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:

More information about the use-livecode mailing list