Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no answer from server on really fast computers #60

Open
sancelot opened this issue Oct 27, 2020 · 7 comments
Open

no answer from server on really fast computers #60

sancelot opened this issue Oct 27, 2020 · 7 comments

Comments

@sancelot
Copy link

Hi,
I had a client (python) / server (jcon) program running fine in a windows 7 computer.

I launched the same program on a really fast computer (3Ghz) and the requests are not seen from the server side .
The socket is connected, but there is no answer from server when making client requests.

What could be the problem ?

@joncol
Copy link
Owner

joncol commented Oct 27, 2020

Hi, can you tests with the small example in src/main.cpp? If that works, maybe make a minimal server and try with your Python client against that? If you get something minimal that doesn't work, I could try reproducing it. It's hard to guess what could be wrong otherwise.

@sancelot
Copy link
Author

I will try a single unittest using only jcon client / server.
I setted up log interface too.
I am not sure at the moment, but I think we may reach JsonRpcEndpoint::dataReady() , but are we sure the whole data is there at this moment , or only a chunk ?

@joncol
Copy link
Owner

joncol commented Oct 27, 2020

Only a chunk. See documentation of the readyRead() signal on https://doc.qt.io/qt-5/qabstractsocket.html.

@sancelot
Copy link
Author

sancelot commented Oct 28, 2020

This sounds to be another kind of problem, running the small exemple program , the log is :

so, I will check if a process uses that port...

JSON RPC server: listening on port 6002
JSON RPC server error: Error listening on port 6002

client :
connecting to JSON RPC server at 127.0.0.1:6002
connected to JSON RPC server 127.0.0.1:6002 (local port: 49475)
Calling (async) RPC method: 'getRandomInt' with argument: 10 (request ID: f084a8af-7fd2-42d7-a37a-533aa076f9df)
Calling (sync) RPC method: 'getRandomInt' with argument: 100 (request ID: c5708e78-8cf0-4651-b3ec-103e13e2c05a)
cannot call RPC method (printMessage) when not connected
Calling (sync) RPC method: 'printMessage' with argument: hello, world (request ID: 069cae7e-3b60-4003-92a8-5180dc06457c)

@kaloskagatos
Copy link

kaloskagatos commented Oct 28, 2020

Hi, "server error: Error listening" seems to indicate your port 6002 might already be in use. Try : sudo lsof -i -P -n | grep LISTEN | grep 6002

Edit: netstat -a -b | findstr 6002 in an elevated command prompt on Windows

On the other hand I added an auto try to connect feature on the client side on top of jcon because if the client is started before the server it fails to connect. On a fast machine the order of process launch may differ.

Best regards

@sancelot
Copy link
Author

netstat -aon | findstr 6002 to find the process id , and then tasklist /fi "pid eq XXXX" to find the process.

There is a process named spnsvrt.exe using this port 😟

@kaloskagatos
Copy link

kaloskagatos commented Oct 29, 2020

Hi, you can choose whatever free port you want from 1024 to 65535. Try 6003 ;)

You can find a free port by using (edit) QTcpSocket::localPort() : https://stackoverflow.com/questions/34678938/platform-independent-qt5-way-to-get-open-tcp-port

You can start your server or client passing the port as an argument on the command line.

Best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants