Doubt on Socket Programming | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Doubt on Socket Programming

Hello, I have a problem with my code shown below. The program compiles successfully without any error. But when running it shows only upto " For testing ". It doesnt print "Waiting for a client ". ie,from the statement just above the accept() function is not working. And when i try to connect to this server program with another program written in python (and on windows platform) it shows error like " ...target system actively refused to connect " My server program is on Ubuntu platform. https://code.sololearn.com/cj6gEmV23HX6/?ref=app

13th Jan 2020, 8:30 PM
Thameem Jabir KJ
Thameem Jabir KJ - avatar
4 Answers
0
Devices on the same network (like many devices connected to a hotspot) share almost similar IP addresses assigned locally but devices on some other network would be invisible to this one. For communication between devices on different networks you would need to check for port forwarding. Below link might help :- https://stackoverflow.com/questions/15308411/communication-betwen-client-and-servver-running-on-two-different-machines-using
19th Jan 2020, 7:42 AM
Tanmoy
0
Did you start the server first? Also check if the port you are using is not being used by some other program (and obviously both the client and server are on the same network).
19th Jan 2020, 6:00 AM
Tanmoy
0
Tanmoy It works well when both server and client programs are executed on the same system..... But the problem is when they are on different networks...... Why is it so....???
19th Jan 2020, 7:05 AM
Thameem Jabir KJ
Thameem Jabir KJ - avatar
0
Tanmoy Okayy.....let me check it...... Thankyou
19th Jan 2020, 3:06 PM
Thameem Jabir KJ
Thameem Jabir KJ - avatar