AGK for Pascal
TAgkNetwork.Host Method

Creates an AGK network with this app as the controller. This app is added as the first client to the network.

class function Host(const Owner: TAgkObject; const NetworkName: String; const ClientName: String; const Port: Integer): TAgkNetwork; static;
const Owner: TAgkObject 
the owner of the network object (eg. a TAgkApplication object). 
const NetworkName: String 
The name to use in identifying this network. 
const ClientName: String 
The name to use in identifying this client. 
const Port: Integer 
The port that other clients should use to connect to this network. 

AGK networks are identified by name and are automatically broadcast to anyone listening on the local area network, meaning that other AGK apps on the LAN can pick up all broadcast networks, display their names to their users and allow them to choose one to join. AGK apps outside the LAN need the IP address and port of the hoster to join the network. This port will need forwarding to the host through any intervening firewall. The port value must be between 1025 and 65535, and will fail if another application is already listening on that port. 

You must also specify a client name to use to identify your client. All client names must be unique. This name will be visible to all other clients. Clients will be added to the network automatically and can be counted using ConnectionCount. You can check IsActive immediately after this command to check that the network was setup successfully, once setup the network will not become inactive for a hoster. 

Once connected the app becomes a client of the network, any other clients that connect to it join the network. All clients are treated equally and have a list of local variables that they can read from and write to, all clients can also read any variables on other clients on a read only basis. 

Some ports are used by AGK for internal networking and should not be used by your application. Port 5689 is used to manage apps broadcasted from the T1 IDE. Port 45631 is used for named network connections. Port 45633 is used for file broadcasting and port 45635 is used by the AGK Viewer to stream content and input data between device and the IDE when native execution is not possible on the device itself.

Copyright (c) 2012. All rights reserved.