QTcpSocket and error
-
I have a problem in my application, i think it's a problem with "arp" table or set ip address.
I have 2 applications "Server" and "Client"
The application "Server" before launching QTcpServer configure and Ad-hoc network and the static ip of Server => 192.168.0.10.
The application "Client" before launching QTcpSocket configure the connexion with the ad-hoc network and its static ip is => 192.168.0.20.I run this application under 2 PC one app for each.
PC A => run "Server"
PC B => run "Client"First case the connection works:
If i run A and after B, the connection is established.
if i run B and after A, the connection is established.The communication work, so I close both applications.
Second case, i switch applications
I run PC A => "Client"
and PC B => "Server"My server say the connection is established at 192.168.0.10.
If i make "ipconfig" on PC B i have 192.168.0.10But my client on PC A cannot join the server, the QAbstractSocketError say 'QAbstractSocket::ConnectionRefusedError' if I make "ipconfig" on PC A I have 192.168.0.20
I have a good response of "ping 192.168.0.10" from "Client"
I have a good response of "ping 192.168.0.20" from "Server"And if i tried on PC A the "Client" to connec with telnet (open 192.168.0.10 port) it doesn't work.??? Why?
If I change the ip address of "Server" to 192.168.0.11, it will working.
In "192.168.0.10" it's seems to be occupied or something like that.
Someone can help me ?Thx
-
Hi! Are your firewalls shut down? MAC (SELinux, AppArmor, Tomoyo) disabled?
-
It's not a problème with firewall because it works in first case.
If I have used ip 192.168.0.x in first case for the server it works.
And if i swith the client and server on pc with the same address 192.168.0.x it doesn't work. -
Hi
How do you assign these ips?If you are on a network with dhcp you can't use what ever
ip you want for static.The correct way is to lower the range for automatically assigned ips on the dhcp router and
then use one of none shared ips for static.
Some routers can also do it based mac addresses. -
Hi
Thanks for your reply.There isn't dhcp because I have no router it's ad hoc network created under windows with cmd:
Netsh wlan start hostednetwork.
And I assign ip address with a command like that:
Netsh interface ip set address name="Wi-Fi" static 192.168.0.10 255.255.255.0. -
Ok it sounds like you know networking pretty well then.
So if its ad hoc, it seems unlikely that the ip be in use.
I have no further ideas it it seems u done ping test etc.Give it some days and see if others have better ideas.
-
Hi,
What port are you using ? Do you have anything else that might use it ?
-
The port used is 5555 but the comminucation works well.
PC A (Server) => 192.168.0.10
PC B (Client) => 192.168.0.20OK
but if i swith server and client.
PC B (Server) => 192.168.0.10
PC A (Client) => 192.168.0.20The connection can be established.
If i change the ip of server in this configuration
PC B (Server) => 192.168.0.11
PC A (Client) => 192.168.0.20it'll work ? But i don't know why.
-
Than a silly question, did you check that the port is not still opened ?
-
How can i do that ? with listening ?
-
netstat
would likely be more appropriate