Sockets (again)

Ralph DiMola rdimola at
Mon Jun 29 17:58:10 EDT 2020


I think you are doing the write too soon.
On the open socket command add "with message "MyConnectionAccepted"
Do the write in the MyConnectionAccepted handler.

Ralph DiMola
IT Director
Evergreen Information Services
rdimola at

-----Original Message-----
From: use-livecode [mailto:use-livecode-bounces at] On Behalf Of Bob Sneidar via use-livecode
Sent: Monday, June 29, 2020 5:42 PM
To: How to use LiveCode
Cc: Bob Sneidar
Subject: Sockets (again)

Hi all. 

I’m trying to get sockets working. The host is working, but I am not getting the message to trigger. Here’s the basic code: 

on mouseUp
   put "test" into tPayLoad
   open socket to "localhost:8085"
   write tPayload to socket "localhost:8085"
end mouseUp

-- socket handlers
on acceptConnections
  accept connections on port 8085 with message "ConnectionMade"
end acceptConnections

on ConnectionMade pIPAddress
  read from socket pIPAddress with message "dataReceived"
end ConnectionMade

on dataReceived pSocket
put pSocket

ConnectionMade gets called, but dataReceived does not. 

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