4 Connecting Imagine via network

At this moment we know:

  • Connect two imagines together locally - on the same computer
  • Send and receive simple texts and use OnReceive event
  • "Change Me" dialog of the NET object.
This tutorial explains how is possible to connect two or more Imagines together in a real network. To make an experiment we will need two computers with installed Imagine. Note, that most part of this tutorial is aimed to those people who will develop server projects.

1. Let's launch Imagine on the first computer. This computer we will call server because we will create and run a simple server project on it:

  • new "NET [style server]
  • net1'connect

01

2. Now, we launch Imagine on the second computer and we create a simple client project. We start programming with familiar sequence of commands with one significant exception:

  • new "NET [style client server xxx]
  • net1'connect

We used to type the localhost word instead of italic xxx characters - but, because the server project is running on different computer we must replace xxx with:

  • A name of the server computer on which the server project is running;
  • Or an IP address of the server computer - IP address is a group of numbers which identify the computer.
We must know at least one of previous information to be able to connect a client to the remote server. Once we know computer name or IP address we may say it to children in class-room or we may send it by e-mail.

3. We made small break and we describe here how to find a computer name or an IP address. Information in this paragraph is important for developers, teachers and peoples that create server version of project.

A. How to find IP Address under Windows 95, 98:
winipcfg IP configuration
Go to the "Start" menu and choose Run… Type winipcfg into edit box and press OK button. This application displays currently assigned IP address and additional information about status of network.

B. How to find IP Address under Windows 2000 and Windows XP:
02
1. Right click on the "Network" icon on the desktop and choose Properties command
03 04
2. Double-click on Local Area Connection 3. The IP address is displayed on the "Support" tab-sheet

C. It is possible to use the Command Line shell under Windows 2000 and Windows XP, too:
05
1. Go to the "Start" menu and choose Run… Type cmd into edit box and press OK button
06 07
2. In the shell window type ipconfing and press Enter. This will displays current IP address

D. Computer name under Windows 2000 and Windows XP we find in "My Computer":
08
1. Right click on the "My Computer" icon on the desktop and choose Properties command
09
2. A computer name is displayed on the "Computer Name" tab-sheet. This name have several parts separated by . (dot) mark. It is possible to use a short part of computer name in a local network.

From the previous description we know that:

  • Our computer has IP number 153.105.89.6 - this is nearly always working (please, ask your network administrator for details about your this)
  • The computer name in our subnet is Lubo - we often use this part of the name for small experiments within one computer room
  • The full computer name in the Internet is Lubo.uniba.edu - this always works.

4. Now, we know the name of our server. So we may continue with creating (modifying) the client application. On the second computer we may type:

  • new "NET [style client server 153.105.89.6]
  • net1'connect
or:
  • new "NET [style client server Lubo]
  • net1'connect
or:
  • new "NET [style client server Lubo.uniba.edu]
  • net1'connect
Note: We often use the first or the second variant. We do not know at this time which one is better - it is always depending on a network configuration where we are connecting Imagines.

12

At this moment it is possible to send data via real network using:

  • Command net1'send [] [Text]
  • Command sh net1'message
  • Event OnReceive to automatically process received message.

Conclusion

We may see that connecting two or more Imagines in a real network is the same as connecting them locally (on the same computer). Because a developer should know name or IP address of that computer on which a server project is running, we tied to describe several ways how to find this information. We recommend ask your network administrator for a help.