Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Eclipse's Networking Manual


Godlord
 Share

Recommended Posts

Eclipse's Networking Manual

Table of Contents

* Introduction
* Networks
* IP-addresses
* Network Interface Cards & Network Adapters
* Transport Protocols
* Application Protocols
* Routers and hubs
* Ports
* Peer-to-Peer and Client-Server
* Network Address Translation or Port Forwarding
* How are packets sent over the net?
* Port Forwarding
* Hamachi
* For Programmers

Introduction

Greetings,

There are a lot of topics about port forwarding, Hamachi and networking in general on Eclipse, but they're actually a waste of bandwidth as there's no common solution to port forwarding. Port forwarding requires common sense and a good understanding of networking. There are however some alternative solutions which might make your life easier, but those might not always work. This manual will give you a bright oversight of networking and will also provide as much help as possible for port forwarding. Even if you don't want to port forward this might be a good educational tool as for understand the concept of networking. You're allowed to ask questions if something is not clear. So lets start.

Network

Well, we first begin with some, probably boring, theory. As it is pretty much required before we can go touch anything. So what is a network exactly? You'll form a network when you connect at least two computers with each other. There are three types of networks in general:

* Local Area Network (LAN)
* Intranet
* Internet

The LAN is actually defined as when the network has a radius of maximum 1 km (about 0.62 miles). The LAN is by far the fastest (10MB/s, 100MB/s and even 1GB/s nowadays) of the networks as it uses the "smallest" area available: the local area.

The Intranet and the Internet both fall under one category called the wide area network (WAN). A network falls under WAN when it has a radius of min. 1 km (about 0.62 milles). As you can already guess, it's the slowest type of networking available.

What's the difference between Intranet and Internet? Intranet is private, that means that it is coomonly used by companies. Lets say you are working for the Coca-Cola Company in England and you've got to send some new product plan to the Coca-Cola Company in the U.S. then you'll most likely have to use the Intranet (although the Internet could/might be instead). The Internet is public, so it's like Intranet but it's used by everyone owning a computer and of course a connection to the Internet with all the accessories.

IP-addresses

Each computer on the internet is like a house on the planet. Each computer has an address assigned like every house on the planet, so each computer connect to the Internet uses an IP address, also called the public IP-address or remote IP-address. Each computer has its own IP-address (in theory) so it can be distinguished. Although, every computer directly connected to the internet has its own IP-address, computers connected to a LAN network will all use the same IP-address of the LAN network.

There are currently two types of IP-addresses that are commonly used:

* IPv4-addresses
* IPv6-addresses

IPv4-addresses are the ones which are currently still in use, but will probably vanish within two years. An IPv4-address is 32-bits in size and thus uses 4 bytes to be represented. The IP-range goes from 0.0.0.0 up to 255.255.255.255, which means that there are 4294967296 unique addresses.

Although IPv4-addresses are widespread, it has a problem to deal with. As there are only 4294967296 unique addresses, we will soon have a shortage. So we have a problem here. There's a solution though: IPv6-addresses. IPv6-addresses use 128-bit instead, which means that there are 2128 unique addresses. IPv6-addresses also use a different notation, it uses hexadecimal characters instead of decimal characters. An IPv6-address can range from 0000:0000:0000:0000:0000:0000:0000:0000 up to ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff. As you can see, the notation is very different.

So far most operating systems will support IPv4 completely. Some moderner operating systems will support IPv6 as well (e.g. Windows Vista, Windows 7, Mac OS X 10.5, Mac OS X 10.6, Linux 2.4, Linux 2.6, Solaris 10, etc.). Eclipse itself however doesn't support IPv6 (yet).

There's a very special type of IP-address which is the loopback address (127.0.0.1 and ::1). The loopback address simply loop backs to the current computer. So it's the IP-address of the current computer.

Network Interface Cards & Network Adapters

To connect to a network a computer would need a card or a chipset, this is usually called the Network Interface Card (NIC) or Network Adapter. Each NIC can be distinguished like every computer can be distinguished, but instead of using an IP-address, NICs use MAC-addresses. Each chip or card has its very own MAC-address and is thus unique. A MAC-address is 48-bit in size and uses a hexdecimal representation, that means that the MAC-address range starts at 00:00:00:00:00:00 and goes up to FF:FF:FF:FF:FF:FF, which also means that there are 281474976710655 unique MAC-addresses. MAC-addresses are usually bound to a NIC and it would require a lot of modification to just change this address. This was done intentionally as they are supposed to be unique.

Transport Protocols

In order to send and receive comprehensible data to and from other computers there needs to be some standard, this is where the transport protocol(s) come in. There are two well-known protocols:

* Transfer Control Protocol (TCP)
* User Datagram Protocol (UDP)

TCP is a stream protocol, whist UDP is a packet protocol. What's the difference? Well, TCP uses a stream of bytes to be send over (so: there is a connection which remains and the data should come in order, thus TCP is reliable). UDP instead uses packets, which each have their own amount of bytes (so: there is no connection required and the data can come in order, thus UDP is "unreliable", more likely chaotic). Why is UDP unreliable though? When using UDP packets can get lost while when using TCP the "packet" would get resend.

UDP and TCP can be compared with telephones and mail. When you're mailing somebody, you're just sending a packet (UDP), but what if the packet gets lost? Then you'll have to resend it. Also you can be waiting for two mails, one is sent a few hours ago and arrived yesterday, while another one was sent two months ago and arrived just now, concluding that the mails were not sent in order. When you're phoning somebody, you'll need a connection. You speak to him/her over the phone which will result in electronic signals going over the cable, this is the stream. The messages should surely come in order and they shouldn't get lost, otherwise we have got a problem here.

Application Protocols

As transport protocols are meant to get data sent and received in a specific way, there's no format for the data itself. The solution for this are application protocols. In order to let two computers understand what each other tries to say, they'll use the application protocol to find that out. Well-known application protocols are IMAP, SMTP, HTTP, FTP, POP3, IRC, Telnet, etc. Eclipse has its very own application protocol as well, so usually these protocols are bound to an application or a set of applications and as you may suspect: Eclipse is not able to communicate with MSN as they're using a different application protocol.

Routers and hubs

In order to form a LAN we use routers or hubs. We'll connect each computer in our network to the router or hub and we'll connect that router or hub to the Intranet/Internet. This means that each computer will use the same public IP address, so how are computers distinguished? It's pretty simple, each router and hub gives each connected computer its unique IP also called the LAN or private IP.

The router/hub will form a gateway and the computers connected to this router/hub will send messages through this gateway to the internet. The router/hub also has its very own IP-address in the network. Computers can usually connect to this IP-address to configure the settings.

Ports

In order to have multiple services running ports were made. The port range is 0 - 65535, but this range can be subdivided into three big groups:

* Well-known ports (used by services like HTTP, FTP, etc.): 0 - 1023.
* Registered ports (used by applications using official connections): 1024 - 49151.
* Dynamic and/or private ports (used by applications using unofficial connections): 49152 - 65535.

Eclipse usually uses port 4000 or port 4001.

Peer-to-Peer and Client-Server

There are two types of connections between computers:

* Peer-to-Peer or Client-to-Client (P2P)
* Client-Server

In P2P both computers are equal, they both serve and get data. In Client-Server, the server serves data for several clients. So, the server keeps track of the data. The second one is the most used design as it is the most reliable and the fastest, although the first one is pretty popular too (e.g.: torrents).

Network Address Translation or Port Forwarding

If a client connects to a server, then it first connects to the router, but there are usually multiple computers that are connected to a router, so which computer is the server? By using Network Address (Port) Translation (NA[P]T) the router will route the data to the right computer. When using NAT, you have a table of ports, each port will either be blocked or unblocked. When a port is blocked, no data will be routed. When a port is unblocked, the data will be routed to the associated LAN IP. The server will be easily found by using NAT. The router will forward the data to the right computer by using the LAN IP and the port specified in the NAT table. This concept is also called port forwarding.

How are packets sent over the net?

This is a very nice video that will show you what happens behinds the cords (or scenes).
http://www.youtube.com/watch?v=Ve7_4ot-Dzs

Port Forwarding

**Note**: port forwarding should only be set up if you're connected through a router or multiple routers, otherwise you won't need this.

Now we'll get to some practice. Before we can actually set up port forwarding you should check what router you have (vendor, type, etc.), which is usually specified on the router itself. If you've done this and you know what router you have then you can go to the site of your vendor and look for a manual and use that, but you can also go to [portforward.com](http://portforward.com/english/routers/port_forwarding/routerindex.htm) and read the instructions. If neither methods work, then you could try this _generic_ method.

**Note**: port forwarding can be done on every device with a browser, these steps will however be Windows-oriented.

The first thing you'll have to do is figure out what the IP-address is of the gateway, what the LAN IP is of your server and what your public IP is.

The public IP is the easiest as it can be seen on a site like [ipchicken.com](http://www.ipchicken.com). The LAN IP and the gateway IP take a bit more than that, but are still easy to find. In Windows you should open a command prompt (a.k.a. MS-DOS prompt). You can do this by executing the "cmd" or "command" command. Now a black window with a gray blinking cursor should appear. You should type "ipconfig" and press enter. Now you're able to see the gateway IP and your LAN IP. If you can't remember them, it's suggested to take notes of these IP-addresses.

The next step is getting into your router, which can be done by opening your browser and browsing to the gateway IP (e.g. http://xxx.xxx.xxx.xxx). You will most-likely be prompted to log in. Usually your account is configured to be something like admin, pass or admin, admin, but this might differ for you. It's recommended to search this information yourself (usually you'll get this from your Internet Service Provider (ISP)). Once you're logged in, you'll most-likely see a menu.

In the menu you should look for something like port forwarding, NA(P)T, something to do with games, applications, ports, translation. If you can't find it, browse a bit through your router. Once you found something that has to do with port forwarding you should add a new entry. For Eclipse you should either use port 4000 or port 4001 as the incoming and outgoing port (Check the data.ini file in your Server-folder). As for the IP, you should set it to be your LAN IP. The protocol should be set to TCP or TCP/UDP. It doesn't really matter. As long as TCP is in there it should be fine. Save the entry and restart your router. Port forwarding should be set up now.

There is one problem left though. What IP should be used by who? It's quite simple actually: if you're trying to connect from the same computer your server is being hosted on, then use the loopback IP. If you're trying to connect from a computer which is connected to the same router as the computer the server is being hosted on, then use the LAN IP of the server. If you're trying to connect from a computer from another network than the computer the server is being hosted on, then use the public IP of the network.

Hamachi

**TODO**: write about Hamachi and other alternatives.

For Programmers

Programmers might be interested into programming applications that use networking. There are various sites which explain how you can do that:

* http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html (C/C++-oriented, but applies to BSD sockets (a.k.a. Winsock) in general)
* http://www.madwizard.org/programming/tutorials/netcpp/ (C/C++-oriented, but applies to BSD sockets (a.k.a. Winsock) in general)
* http://tangentsoft.net/wskfaq/ (C/C++-oriented, but applies to BSD sockets (a.k.a. Winsock) in general)
* http://msdn.microsoft.com/en-us/library/ms740673%28VS.85%29.aspx (Winsock Documentation)
* http://www.15seconds.com/Issue/010820.htm (VB6-oriented)
* http://www.devx.com/vb2themax/Article/19879 (VB6-oriented)

Yours faithfully,
  Stephan.
Link to comment
Share on other sites

  • 3 months later...
  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...