1

I'm currently trying to setup a client-server environment with Freeling. I can run the server without problems with the following launch command:

analyzer -f %FREELINGSHARE%\config\it.cfg --lang it --server --port 3330 --flush --inpf plain

However, any time a client tries to perform analysis through socket (tried from both shell and Matlab environment) the server closes once it finishes to process such request. That's behaviour forces to re-launch the server for each client request. From the documentation, it seems that a new process should be forked for each client, cit.

The server will fork a new process to attend each new client, so you can have many clients being served at the same time.

N.B I'm using Freeling version 3.1

fedorqui
  • 275,237
  • 103
  • 548
  • 598
Yuri Ricci
  • 31
  • 4

2 Answers2

0

After some tests I have concluded the following:

1) I am experiencing a bug which is related to the combination of Freeling server and Windows OS. Basically, the analyzer.exe program does not fork a new process at every new client request, as it should be, but performs the analysis with the current process, causing the termination as soon as the client disconnects. This is probably due to the improper handling of sockets, which is different for different OS.

2) The previous point seems to be confirmed by the correct behaviour of a linux-based server. However, Freeling for linux is tied to specific linux versions, which also are quite outdated. This constraint is due to dependencies that cannot be satisfied by newer distributions.

As a concluding remark, at the time of this writing the best solution seems to be the custom development of a socket server which makes use of Freeling libraries.

Yuri Ricci
  • 31
  • 4
0

Looking at the code, this seems to be the default behavior.

  // if we are a forked server attending a client, and the client is done, we exit.
if (ServerMode) CloseWorker(stats);

If you have 2 clients open and submit a request with 1 it will close the connection when it's finished but it should still be able to accept requests from the 2nd client. Instead of restarting the server every time, you can just create a new client. You can always modify the CloseWorker function to close the socket based off certain criteria to keep the client connection open.

It seems that this application can accept multiple clients but its unable to accept multiple requests from multiple clients.