IP Communication
192
NetLinx Programming Language Reference Guide
 Protocol: The transport protocol to use (1 = TCP, 2 = UDP). If this parameter is not specified,
TCP (1) is assumed. The constants
IP_TCP and IP_UDP can be used to specify this
parameter.
Multiple client connections
With connection-oriented I/O (TCP), more than one client could request a connection with the server at
the same time. Support for multiple client connections applies only to connection-oriented I/O, that is,
TCP protocol. Opening multiple ports using UDP as the protocol serves no purpose. In that case, any
additional open commands will fail.
To support concurrent requests, the server must call
IP_SERVER_OPEN once for each simultaneous
connection allowed. For example:
IP_SERVER_OPEN (First_Local_Port, 10510, IP_TCP)
IP_SERVER_OPEN (First_Local_Port, 10510, IP_TCP)
IP_SERVER_OPEN (First_Local_Port, 10510, IP_TCP)
This allows three simultaneous connections on port 10510. Note that each call to IP_SERVER_OPEN
uses a different local port number.
Closing a local port
To close a local port, the server application must call IP_SERVER_CLOSE. Once that is called, no
I/O can be handled using the specified local port. The syntax:
IP_SERVER_CLOSE(LocalPort)
Parameters:
 LocalPort: The local port number to close.
Connection-oriented notifications
The server receives the following notifications when a client connects or disconnects. The protocol in
this case must be TCP.
DATA[0:LocalPort:0]
{
ONLINE:
{
// client has connected
}
OFFLINE:
{
// client has disconnected
}
}
Parameters:
 Device is (or contains as part of an array) the device representing the conversation
(0:LocalPort:0).