Beginner's corner |
Top Previous Next |
Hook me up with the network This article will help you to connect 2 PCs using the phone, a serial cable, a local area network or the internet; we will learn how to run the battleship multiplayer clone. The bad news The good news 1) I have a single computer and I want to connect to my grandmother's computer using the phone line. Your PC is faster so it should run as server and client. 2) I have a single computer and I want to connect to my grandmother's computer (she lives in the same building) using a serial cable.
3) I have two or more computers and I want to connect them using a local area network. Here are the network properties for two of my computers: 4) I have a computer and I want to play battleship over the internet. Acknex uses the tcp / ip protocol by default so the steps that are needed in order to run the game are exactly like in the picture above. The problem here is to get the dynamic IP address if we're in the b) situation because we need to send it to the client using the email every time we connect to the internet. The following info was tested on Win98 and Win2000 PCs but it should work ok on Win ME and WinXP. To get your IP address in Windows 98, Press Start -> Run, type "winipcfg" (without the quotes) and press OK. You will see the following program window: You can see that the IP address is 0.0.0.0; this happens because this PC isn't connected to the internet for the moment. Always start your internet connection first and only after a successful connection get and send the IP address! If you have a network card installed in your PC be careful: you need to get the IP address for your PPP Adapter, like in the picture. If you need to get your IP address in Windows 2000, press Start -> Programs -> Accessories -> Command prompt. Type "ipconfig" (without quotes) and press Enter; you should see this window: This time I have connected to the internet first so I have got a good IP address. I need to send this address to the client that will connect to my server using an email, a messenger client, etc. All we need to know is server's IP address because the clients connect to it; if you are a client you don't need to know or to send your IP address. Another method that allows you to get your IP address works ok on any PC, regardless of the operating system. Go to http://www.whatismyipaddress.com/ and you will see your IP address like in the picture below: Ok, the last method can be used if you are a programmer: LocalIP returns the IP address of the local machine using the winsock activex control. IMPORTANT INFO: The server has to run first. If the client runs before the server, it will fail to connect and all you can do is to exit and restart after the server has started to run.
|