Server Programming; Listening For Client Requests - AMX NETLINX PROGRAMMING LANGUAGE Manual

Programming language
Table of Contents

Advertisement

When processing string data from a device, whether it is a regular device or an IP socket, the master will
attempt to copy this data to a buffer, if one has been created using the
then try to run a
does not exists, Netlinx will run mainline to allow for any buffer processing that might occur in mainline.
At the end of a conversation with an IP device, there will usually be an incoming string event followed
by an offline event. The NetLinx master will copy the string to a buffer, if it exists, check for a string
event handler, run mainline if one does not exist, then process the offline event.
If you are processing that data in an offline event for an IP device, you will see a time delay between the
IP device or server closing the connection and the processing of the offline event. This delay will vary
with the size and complexity of mainline.
To eliminate this delay, simply include and empty string event handler in the
will keep NetLinx from running mainline between the last incoming string and the offline event. See this
example:
DATA_EVENT[dvIP]
{
OFFLINE:
{
(* PROCESS THE DATA HERE*)
}
STRING:
{
(* DO NOT REMOVE ME! *)
}
}

Server Programming

Listening for client requests

A client gains access to a service by sending a request to the server specifying the port assigned to the
service. For the request to be acknowledged, the server must be listening on that port. To do this, the
server calls
client applications.
IP_SERVER_OPEN
port, as opposed to an actual physical port on the server. When TCP is the transport protocol, the local
port represents a single client connection on the server's physical port. When UDP is the transport
protocol, it represents a single point where all client requests on the associated port are routed.
The local port number is the key to identifying data sent to or received from a client application. A local
port number may not be used in another call to
for that port number. The syntax:
IP_SERVER_OPEN(LocalPort, ServerPort, Protocol)
Parameters:
NetLinx Programming Language Reference Guide
DATA_EVENT...STRING
. This opens the port and allows the server to listen for requests from
IP_SERVER_OPEN
requires the caller to supply a local port number. This local port number is a virtual
LocalPort: The local port number to open. This port number must be passed to
to close the conversation.
IP_CLIENT_CLOSE
ServerPort: The port number on the server identifies the program or service the client is
requesting.
CREATE_BUFFER
handler for this device. If a
DATA_EVENT...STRING
until
IP_SERVER_OPEN,
IP Communication
keyword, and
handler
section. This
DATA_EVENT
is called
IP_SERVER_CLOSE
191

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Netlinx studio 2

Table of Contents