|
www.astatech.com |
![]() |
![]() |
|
|||||||||||||||||||||
|
Connecting Clients & Servers
ASTA is based on the TCP/IP protocol. In order to use it successfully, you don't need to know a lot about TCP/IP but it helps to know some basic principles. AstaServers and AstaClients "speak" to one another using sockets. A socket is the combination of an IP Address and a Port. The following socket, 204.125.124.10:3245, has an IP address of 204.125.124.10 and a port of 3245. An AstaServer starts a socket that can handle multiple connections.
When you look in the object inspector for an AstaServerSocket, you will
notice that there is not an Address property but there is a port
property. The AstaServerSocket's will automatically assume the system's
IP address for its address -- if you start it on a system with an IP
address of 204.125.124.10 then it's IP address will be 207.125.124.10.
The AstaServerSocket will use the port that you assign to it, in our
example, Port 9000. If your server's IP address is 204.125.124.10, and
you assign Port 9000, then your server will be listening for
connections on the following socket: 204.125.124.10:9000. [To determine
the IP Address of a Windows NT system, type IPCONFIG at the DOS Command
Prompt. For Windows 95 I believe the command is WinIPConfig].
When you create your clients, you must specify the Address and the Port of the server. In this case, you would set that AstaClientSocket to 204.125.124.10 for the address and 9000 for the Port. If you wish to see design time data when writing your application, you must specify the correct address and port and the server must be running! The AstaClientSocket's Host property can be used for DNS names. If you are using DNS and your server has a name you can enter "YourServerName.Com" in the Host property. If that field is used, it will override the value in the Address property. You must specify the port whether you use the Host property or the Address property. For detailed information on the OnConnect, OnDisconnect and OnAccept events, please see Borland's help file entries for the TClientSocket and TServerSocket. There is a bit of counter-intuitive behavior at the server that can be confusing for the novice; the OnAccept event, not the OnConnect event, is the first point where the server actually has meaningful access to the client connection. Special Notes for the server: Special Notes for the client: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Last modified: 5/5/2002 7:31:53 AM |
||
| Copyright © 2001-2002 |
|