-
Client-server on a LAN
Hello, I'm trying to explore the basics of networking. Let me introduce my working zone: 2 PC (both with Windows XP, one with SP1 and the other with SP2), both connected to the same router.
I have been testing with some manuals and tutorials about winsock (also winsock2, but for the moment I use the synthax explained on winsock1), till I create a basic server and a basic client. On the same PC they work great, server listens on port 80, accept connections through 'INADDR_ANY', and client can connect to the server as 'localhost' or as '127.0.0.1' (the localhost IP, I think that's the localhost IP because there's only one aliases on the IP's aliases list). Till that point all is right.
But now I would like to run the server on a PC and the client on another: I'm right supposing that both 2 PC connected on the same router is a LAN? On the net connections attributes ('start->config->net connections->LAN connection', I'm not running english windows version , that's a literal translation so I suppose that the names will be similar) appears a tab control for the LAN compatibility, and it says
Code:
On PC #1
IP adress : 172.16.0.4
On PC #2
IP adress : 172.16.0.5
On both there's the same "subnet mask : 255.255.255.0" and the same "predefined bla bla (sorry, I' don't know how to translate that) : 172.16.0.1"
Well, now I run the server on PC #2 (that PC have SP2, and it says 'Would you like to block...?", I say "Don't block my server") I test in local mode with the client and it works, so I can confirm that the SP2 allow me to work with servers and clients.
On both PC's, when I run the server and client on the same PC, altought the IP adress is 172.16.0.x I should use the localhost IP that is 127.0.0.1 (for both PC's).
Finally I try to run the server on on PC #2, the client on PC #1, but it does not work. If I use the localhost IP (127.0.0.1, or whatever variant 127.0.0.x) the client gets an error 10061; if I try to connect the client to the IP adress of the PC#2 (172.16.0.5) I get an error 10060; if I try to connect to the subnet mask the error is 10049. I have the same errors if I run the server on PC #1 and the client on PC #2.
How can I solve that problem? Or where can I find more info about that?
Thank's in advance
Niara
-
You can find a list of winsock error codes here. You are correct to use the IP address of the server computer (172.16.0.5). Firstly make sure you can ping the other computer (run the command ping 172.16.0.5). Other than that make sure you don't have other firewall software that could be blocking the connection.
-
Hello anonytmouse, thank's for your time. I'll take a look on your recommendations and post back the results.
Niara
-
Hey, that works!!!
I have find that the problem was me and my settings of the windows firewall; when I run the server program, the firewall asks for what to do with the connections: block all, no block never, or ask before. I thought that "ask before" was similar to "allow that run, but ask what to do in new program runnings". Finallly I have done the next: on PC #2 with SP2, I start the server, a windows alert asks me for block/non block the server so I tell it no block it never.
Now I can continue my work.
More thank's anonytmouse for your help.
Niara