Open Socket With Messages

Mike Bonner bonnmike at gmail.com
Mon Jul 6 16:54:20 EDT 2015


Hmm. YOu might check socketError

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

on mouseUp
   put "www.google.com:443" 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
fires.

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 iotecdigital.com>
wrote:

> Out of curiosity, would having these handlers in a frontscript be a
> problem?
>
> Bob S
>
>
>
> _______________________________________________
> 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