Reputation: 739
I'm trying to develop a little client-server application in c. For that, I took a source code : http://www.iprelax.fr/outils/c_prog5.php
It's working in local without changing the ip address or the port. I tried with 2 computers (mac os and ubuntu). They are connected with an ethernet cable and we defined a static ip addresses 10.0.0.10 and 10.0.0.20 on this interface (eth0). In the client, we changed the line :
char *msg, *htoname = "127.0.0.1";
with the server ip address but it doesn't work, there is no error.
We tried to change the port number but still the same problem.
We saw anything with the netstat and netcat commands.
How to run the application between 2 computers ?
Thank you for your help
Upvotes: 2
Views: 1211
Reputation: 5535
When going between two machines, generally a firewall blocks incoming connections i.e. your server machine should allow client to connect to itself.
If your server is on Ubuntu, you are using Linux IP tables. Either add a rule to allow the server port for incoming connections or disable IP tables entirely.
vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5800 -j ACCEPT
The answer to this question list it in detail
using ip tables on stack overflow
Upvotes: 2