Issue connecting to listener using LrSocket send
I am creating an LR plugin to commuicate with my macOS app and am using LrSocket.
So far, I have successfully created the LrSocket to receive, but I am unable to get the send client to connect.
I am using a different port for each of them and am testing with the sample code provided by Adobe in the documentation as under:
local LrFunctionContext = import "LrFunctionContext"
local LrTasks = import 'LrTasks'
local LrSocket = import 'LrSocket'
local LrDialogs = import 'LrDialogs'
LrTasks.startAsyncTask( function()
LrFunctionContext.callWithContext( 'socket_remote', function( context )
local running = true
local sender = LrSocket.bind {
functionContext = context,
plugin = _PLUGIN,
port = 1235,
mode = "send",
onConnecting = function( socket, port )
LrDialogs.message("Connecting")
end,
onConnected = function( socket, port )
sender:send( "Hello world\n" )
LrDialogs.message(port)
end,
onMessage = function( socket, message )
end,
onClosed = function( socket )
running = false
end,
onError = function( socket, err )
if err == "timeout" then
socket:reconnect()
end
end,
}
sender:send( "Hello world\n" )
while running do
LrTasks.sleep( 1/2 ) -- seconds
end
sender:close()
end )
end )
The LrSocket just gets stuck on Connecting before timing out.
Can someone please guide as to what is going wrong?
