I'm working on Linux, and I don't know if that is a problem even in WIndows.
Well, I'm creating a network (now on my PC for testing...) in this way:
SERVER:
Code: Select all
(command-event (fn (c)
(println (string "COMMAND IS: " c) )))
newlisp check-port.lsp -c -d 4702
CLIENT:
Code: Select all
alessandro@alessandro1 ~ $ newlisp
newLISP v.10.1.1 on Linux IPv4, execute 'newlisp -h' for more info.
> (net-eval "127.0.0.1" 4702 {(+ 3 4)})
"COMMAND IS: [cmd]\n\nnil\nnil\nCOMMAND IS: (+ 3 4)(exit)\n\nnil\n\nERR: symbol expected : \" IS: (+ 3 4)(exit)\\n\"\n"
> (net-eval "127.0.0.1" 4702 {(+ 3 4)})
"COMMAND IS: [cmd]\n\nnil\nnil\nCOMMAND IS: (+ 3 4)(exit)\n\nnil\n\nERR: symbol expected : \" IS: (+ 3 4)(exit)\\n\"\n"
> (net-eval "127.0.0.1" 4702 {(setq a 1)})
"COMMAND IS: [cmd]\n\nnil\nnil\nCOMMAND IS: (setq a 1)(exit)\n\nnil\n\nERR: symbol expected : \" IS: (setq a 1)(exit)\\n\"\n"
>
* Sometimes the client hangs: lock prompt as if the server is "sleeping" (in this case if I stop the server then the client comes live again).
* Sometimes I simply get, as result, the string "[cmd]" (6 chars). Nothing else. Even if I insert many input commands.
* Sometimes I get the result you can see above.
What is happening? I think I'm doing something wrong, but where?
NOTE: If I eliminate the function (command-event) then everything is correct.
I need to use that function since I'm creating a centralized job scheduler. I have several PC, and I use a central unique server to schedule some activities. In the "client" computers I have newLisp as server (wait for "net-eval").
When in the central server an event happen, then it send the proper job to the client. I implemented some security features, but I need to use (command-event) to check the command that reach the PC clients, to avoid PC abuse.
Can you help me?
Thank you!