API Programmers Reference Guide - LINX Data Terminals
API Programmers Reference Guide - LINX Data Terminals
API Programmers Reference Guide - LINX Data Terminals
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>LINX</strong> V<br />
<strong>API</strong> <strong>Programmers</strong><br />
<strong>Reference</strong> <strong>Guide</strong>
March 31, 2004<br />
Copyright <strong>LINX</strong> <strong>Data</strong> <strong>Terminals</strong>, Inc.<br />
All Rights Reserved
Contents<br />
<strong>LINX</strong> 5 <strong>API</strong>-C <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> 1<br />
Overview ...................................................................................................................................1<br />
Function List:.............................................................................................................................1<br />
Include Files: .............................................................................................................................2<br />
Module Specifics .......................................................................................................................2<br />
The Unit Table...........................................................................................................................2<br />
Using the Server ........................................................................................................................2<br />
Time Management .....................................................................................................................3<br />
Writing Alternate Servers ..........................................................................................................3<br />
Special Stuff ..............................................................................................................................3<br />
Function Calling Sequences.......................................................................................................4<br />
Function: Ltime() ........................................................................................................4<br />
Function: Elapsed (t,n) ................................................................................................4<br />
Function: L5MakeTable (n)........................................................................................4<br />
Function: L5AddUnit (“hhhhhhhhhhhh”) ..................................................................4<br />
Function: L5SetServer(v) ............................................................................................4<br />
Function: L5Open (Bufs, NetBufs) .............................................................................5<br />
Function: L5Close()....................................................................................................5<br />
Function: L5C()..........................................................................................................5<br />
Function: L5Ready (n) ...............................................................................................5<br />
Function: L5StateText (n,s)........................................................................................5<br />
Function: L5AddrText (n, s, f) ...................................................................................6<br />
Function: L5ErrText (&string) ...................................................................................6<br />
Function: L5Idle () .....................................................................................................6<br />
Function: L5Send (n, “text”) .......................................................................................6<br />
Function: L5 Receive (s, &f).......................................................................................6<br />
Function: L5SetMonitor (v) ........................................................................................7<br />
Function: L5SetSubNetwork (v) ................................................................................7<br />
<strong>LINX</strong> 5 Protocol <strong>Reference</strong>.........................................................................................7<br />
Application <strong>Data</strong>..........................................................................................................8<br />
Linx Network Architecture Packet ..............................................................................9<br />
Linx 5 Full Server Implementation ...........................................................................10<br />
Linx 5 Limited Server Implementation .....................................................................11<br />
Alternate Servers .......................................................................................................11<br />
<strong>LINX</strong> 5 IPX Packet ...................................................................................................12<br />
<strong>LINX</strong> 5 LLC Packet Structure...................................................................................13<br />
<strong>LINX</strong> 5 Ethernet Packet Structure.............................................................................13<br />
Appendix A..............................................................................................................................15<br />
The Whole Packet .....................................................................................................15<br />
Net <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> 17<br />
Function List............................................................................................................................17<br />
Include File:.............................................................................................................................17<br />
Overview .................................................................................................................................18<br />
<strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong><br />
Contents • iii
Predefined Types .....................................................................................................................18<br />
Function: NetAvail ( ) ..............................................................................................18<br />
Function : NetWrite ( &NetAddress, &data, n).........................................................18<br />
Function: NetFlush ( ) ..............................................................................................19<br />
Function: NetRead( &NetAddress, &data, n)...........................................................19<br />
Function: NetWrite (&NetAddress, &data, n)..........................................................19<br />
Function: NetOpen (buffersize, count, ssocket, dsocket) .........................................19<br />
Function: NetClose ( ) ..............................................................................................19<br />
Function: NetErr ( ) ..................................................................................................20<br />
Function NetErrText (&string)..................................................................................20<br />
<strong>LINX</strong> 5 DOS Utilities Users <strong>Guide</strong> 21<br />
Program List ............................................................................................................................21<br />
L5List.exe : List the <strong>LINX</strong> 5’s on the network.........................................................21<br />
L5Chat.exe : Direct interaction with <strong>LINX</strong> 5’s .......................................................22<br />
L5Load.exe : Download files to one or more <strong>LINX</strong> 5’s..........................................22<br />
L5Go.exe : Start a loaded Basic application............................................................23<br />
L5Abort.exe : Stop an executing Basic application.................................................23<br />
Close.exe : Close an open socket.............................................................................23<br />
<strong>LINX</strong> 5 Network Activity Statistics 24<br />
Introduction .............................................................................................................................24<br />
Passive Loading.......................................................................................................................24<br />
Inactive Loading ......................................................................................................................25<br />
Active Loading ........................................................................................................................25<br />
Conclusion...............................................................................................................................26<br />
iv • Contents<br />
<strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong>
<strong>LINX</strong> 5 <strong>API</strong>-C <strong>Programmers</strong><br />
<strong>Reference</strong> <strong>Guide</strong><br />
Overview<br />
This <strong>API</strong> (Applications Program Interface) is used to interact with a Linx 5 terminal<br />
network.<br />
Function List:<br />
L5MakeTable<br />
L5AddUnit<br />
L5SetServer<br />
L5Open<br />
L5Close<br />
L5C<br />
L5Ready<br />
L5StateText<br />
L5AddrText<br />
L5ErrText<br />
L5Idle<br />
L5Send<br />
L5Receive<br />
Ltime<br />
Elapsed<br />
L5SetSubNetwork<br />
: Creates a unit table<br />
: Adds a unit to the unit table<br />
: Set the server type for multiserver mode<br />
: Start the Linx 5 server<br />
: Shut down the Linx 5 server<br />
: Returns number of units in table<br />
: Returns TRUE if the unit is ready<br />
: Get the text description of the state<br />
: Get a text description of the unit address<br />
: Get text of the last bad error<br />
: Allow background server activity to continue<br />
: Send a record to a unit<br />
: Get a record from a unit<br />
: Time in milliseconds since midnight<br />
: Measures time elapsed in milliseconds<br />
: Enables subnetworks from ENET Gateways<br />
<strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> 5 <strong>API</strong>-C <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> • 1
Include Files:<br />
Defines.h<br />
L5<strong>API</strong>.h<br />
: Required include files and contents<br />
: Function declarations<br />
Module Specifics<br />
This interface is written in Borland C version 4.0. The C++//comment is used<br />
throughout the code. If you recompile these modules with another compiler, you<br />
may need to change the comments to /*…*/form.<br />
The Defines.h include file will need to be included in your module before L5Api.h.<br />
The default buffer counts should be upped if you are implementing a number of<br />
programs on larger networks.<br />
The Unit Table<br />
The unit table is a structure internal to the L5 server. You have limited access to this<br />
table via these routines:<br />
Using the Server<br />
L5MakeTable<br />
: Creates a unit table<br />
L5AddUnit<br />
: Adds a unit to the unit table<br />
L5C<br />
: Returns number of units in table<br />
L5Ready<br />
: Returns TRUE if the unit is ready<br />
L5StateText<br />
: Get the text description of the state<br />
L5AddrText<br />
: Get a text description of the unit address<br />
This table has a maximum size that is set by L5MakeTable. If you don’t call<br />
L5MakeTable then it assumes a default size. As units are detected by the server,<br />
they are added to the table. The table has L5C() entries, a number which can only<br />
get larger as units are found. When a unit stops responding it is marked as Offline,<br />
but is NOT removed from the table. If your application sends to units that are not<br />
L5Ready() the record is ignored.<br />
Simple programs can begin by calling L5Open(0,0) to start the Linx Server. If your<br />
application has a predefined table of terminal addresses then you should first allocate<br />
the table using L5MakeTable and fill it with L5AddUnit.<br />
If L5Open returns TRUE then the server has started successfully. This does not<br />
mean that any units were detected. Use L5C for that.<br />
Reading consists of calling L5Receive until non-zero. You cannot select which unit<br />
will send you data. You must process the data as it becomes available. If your<br />
application has long periods in which it is not reading from the units then it should<br />
call L5Idle. Note that failing to call L5Receive can result in filled receive buffers<br />
and a fatal server error.<br />
2 • <strong>LINX</strong> 5 <strong>API</strong>-C <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong>
Time Management<br />
L5Send will send a record to a single unit or all units.<br />
If any routine has an error, the text description of that error can be obtained with<br />
L5ErrText.<br />
You MUST call L5Close before exiting your program. Failure to do so may leave<br />
network resources unavailable for the next time you run the program.<br />
The following functions are made available for simple timer management:<br />
Ltime<br />
Elapsed<br />
: Time in milliseconds since midnight<br />
: Measures time elapsed in milliseconds<br />
The Elapsed function will not work properly if two times differ by more than 24<br />
hours. Any time comparisons should be within that range. These functions use bios<br />
calls that are compatible with Windows but NOT other operating systems. The<br />
actual timer resolution is only good to 55 milliseconds. Do not attempt to use<br />
Elapsed for shorter times since it won’t work.<br />
Writing Alternate Servers<br />
When in multiple server<br />
mode an attempt to start<br />
the main server will<br />
ALWAYS take more than a<br />
minute as it checks for the<br />
presence of alternate<br />
servers.<br />
If your application is running in a multiple server environment then you need to call<br />
L5SetServer BEFORE calling L5Open. When you call L5Open, it will return<br />
FALSE if you cannot be the server yet. You must repeatedly call L5Open until it<br />
returns TRUE.<br />
While running in Multiple server mode you must check the global variable: BOOL<br />
L5ServerReady every few seconds to determine if the server is still running. If a<br />
main server has taken over you must call L5SetServer and return to calling L5Open<br />
until your server is again allowed to run.<br />
Special Stuff<br />
To get printf monitoring of network traffic you can use:<br />
extern BOOL L5ShowRx = TRUE; //Display data as it is read<br />
extern BOOL L5ShowTX = TRUE; // Display data as it is written<br />
<strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> 5 <strong>API</strong>-C <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> • 3
Function Calling Sequences<br />
Function: Ltime()<br />
Returns: Return the time since midnight in milliseconds<br />
Proto: longLtime (void)<br />
Function: Elapsed (t,n)<br />
Usage: Determine if a time interval has elapsed.<br />
This is used in conjunction with the Ltime function which returns the time<br />
since midnight in milliseconds.<br />
Returns: TRUE when n millisecond has elapsed.<br />
Example: long t=Ltime();<br />
while (!Elapsed (t,1000)) {…do stuff for a second…};<br />
Proto: BOOL Elapsed (long, long)<br />
Function: L5MakeTable (n)<br />
Usage: Allocate the Linx 5 status table. This MUST be called before L5Open if you<br />
need more thatn the default number of terminals. Se L5AddUnit to pre allocate<br />
places for units in the table. Each unit uses about 300 bytes of global memory.<br />
Returns: TRUE if successful<br />
Proto: BOOL L5MakeTable (int)<br />
Function: L5AddUnit (“hhhhhhhhhhhh”)<br />
Usage: Adds a <strong>LINX</strong> 5 to the table. Each AddUnit must be a unique fully qualified<br />
address in the format: “hhhhhhhhhhhhmmnn” ehrtr hhh… is the node number,<br />
“mm” is the optional master number, and “nn” is the optional station number.<br />
Unit handles are integers from l to L5C();<br />
Returns: unit handle in the table (0 if table is full)<br />
Proto: L5HANDLE L5AddUnit (char*s)<br />
Function: L5SetServer(v)<br />
Usage: Set the type of server that this one is.<br />
0=normal server, no alternate servers allowed<br />
1=main server, take control from alternates<br />
2=alternate server, only take control if main stops<br />
This must be called before calling L5Open. Call L5Open repeatedly unit it<br />
becomes TRUE.<br />
Proto: void L5SetServer (int v)<br />
4 • <strong>LINX</strong> 5 <strong>API</strong>-C <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong>
Function: L5Open (Bufs, NetBufs)<br />
Usage: Start a Linx 5 Server. All of the Linx 5 terminals are brought on line. If a<br />
unit has not been placed in the unit table by AddUnit then it will be added to the end<br />
of the table. This can take a few seconds to execute. Bufs specifies the number of<br />
receive buffers to allocate. 0 will default to the number of units in L5MakeTable.<br />
The NetBufs parameter is used to set the number of low level buffers. By default<br />
this is 30 but may be increased up to 50 if you find yourself losing packets. Both<br />
Bufs and NetBufs use about 256 bytes per buffer. Leave things 0 when you don’t<br />
understand them.<br />
Returns: TRUE if successful.<br />
Proto: BOOL L5Open (int, int)<br />
Function: L5Close()<br />
Usage: Shuts down the server and releases the buffers. This causes all Linx 5’s to<br />
go offline.<br />
Proto: Void L5Close(void)<br />
Function: L5C()<br />
Usage: Returns the current size of the unit table. This must be called every time the<br />
table is examined since new units can be added at any time.<br />
Returns: number of units in the terminal table<br />
Proto: int L5C(void)<br />
Function: L5Ready (n)<br />
Returns: Returns TRUE if the unit is Online and ready for data.<br />
Proto: BOOL L5Ready (L5HANDLE)<br />
Function: L5StateText (n,s)<br />
Usage: The state description string for unit n is placed into string s (3 to 10<br />
characters). If NULL is provided for the string then only the state number is<br />
returned.<br />
Returns: State number (see L5State enumerated type)<br />
Proto: int L5StateText (L5HANDLE, char*)<br />
Example: for (i=1;i< L5C();i++) { char s[11];<br />
L5StateText(i,s); printf (“Unit%d:%s\n”,i,s);}<br />
<strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> 5 <strong>API</strong>-C <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> • 5
Function: L5AddrText (n, s, f)<br />
Usage: Get the address string for unit n. The type of string to get is determined by f:<br />
f=0: “hhhhhhhhhhhh” (Network node only)<br />
f=1: “hhhhhhhhhhhh” mm-nn” (node, master, station)<br />
f=2: “nnnnnnnn hhhhhhhhhhhh mm-nn” (add network)<br />
f=3: “ssss nnnnnnnn hhhhhhhhhhhh mm-nn” (add socket)<br />
Proto: void L5AddrText (L5HANDLE, char*, int)<br />
Function: L5ErrText (&string)<br />
Usage: Returns the last error code and its text description<br />
Proto: WORD L5ErrText (char*txt)<br />
Function: L5Idle ()<br />
Usage: Keeps the Linx 5 terminals on line. Does not need to be called if an L5Send<br />
or L5Receive is issued at least once every 30 seconds.<br />
Returns: TRUE if there was any network activity on this call<br />
Proto: BOOL L5Idle (void)<br />
Function: L5Send (n, “text”)<br />
Usage: Send a record. Note that this can cause a pause if the transmit buffer is full<br />
for this unit. It is rare for pauses to occur. Use n=0 for broadcast.<br />
Proto: void L5Send (L5HANDLE i, char*s)<br />
Function: L5 Receive (s, &f)<br />
Usage: Receive a data record and get the unit handle.<br />
The optional &f (may be NULL) is the type of the record.<br />
f=0 on status messages (ON, BASIC, etc. )<br />
f=100 on BASIC errors (record starts with “BASIC”)<br />
f=101 on network diagnostic responses (start with “ND”)<br />
f=1 to 99 on normal records generated by applications.<br />
Returns: 0 if nothing is available.<br />
Proto: L5HANDLE L5Receive (char*, int*)<br />
6 • <strong>LINX</strong> 5 <strong>API</strong>-C <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong>
Function: L5SetMonitor (v)<br />
Usage: Enable server monitoring to standard out<br />
0 = no monitoring<br />
1 = full, 2 = rx only, 3 = tx only<br />
Proto: void L5SetMonitor (int v)<br />
Any <strong>LINX</strong> 5 acting as a<br />
Gateway MUST have a<br />
Terminal Number of 1.<br />
This is the ONLY way that<br />
the gateway is identified.<br />
Function: L5SetSubNetwork (v)<br />
Usage: Set the type of server that this one is.<br />
0 = no subnetworking is allowed<br />
1 = subnetworks are supported<br />
Proto: void L5 SetSubNetwork (int v)<br />
<strong>LINX</strong> 5 Protocol <strong>Reference</strong><br />
This is the low level protocol description for the <strong>LINX</strong> 5. Users of the L5<strong>API</strong> can<br />
usually remain blissfully unaware of any of the following material. It is included to<br />
make a detailed understanding of the operation of L5<strong>API</strong> and NET<strong>API</strong> possible.<br />
Due the wonders of modern communications layering when using the Novell IPX<br />
protocol the packet structure is:<br />
APPLICATION DATA is contained in an<br />
LNA PACKET which is enclosed in an<br />
IPX PACKET which is encapsulated in the<br />
LLC PACKET which is embedded in an<br />
ETHERNET IEEE 802.3 FRAME<br />
While this sounds really nasty (and it is), there is not actually a lot of overhead since<br />
the overall Ethernet frame has to be a minimum of 64 bytes long anyway.<br />
When using TCP/IP protocol, the structure is modified to:<br />
APPLICATION DATA is contained in an<br />
LNA PACKET which is enclosed in an<br />
UDP PACKET which is tagged onto an<br />
IP PACKET which is embedded in an<br />
LLC PACKET which is embedded in an<br />
ETHERNET IEEE 802.3 FRAME<br />
<strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> 5 <strong>API</strong>-C <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> • 7
Application <strong>Data</strong><br />
Application data falls into a few major categories. These are:<br />
BASIC Tx <strong>Data</strong><br />
BASIC Rx <strong>Data</strong><br />
<strong>LINX</strong> Status Messages<br />
NETWORK Directives<br />
NETWORK Directive replys<br />
TEST Record<br />
BASIC Tx <strong>Data</strong>: This is data generated by a BASIC application program and<br />
transmitted by the application to the HOST or NET devices. This can be wither<br />
LDATA (sequenced) or UDATA (unnumbered). All data received from <strong>LINX</strong> ¾<br />
subnetworks is LDATA.<br />
BASIC Rx <strong>Data</strong>: This is data generated by the server or another <strong>LINX</strong> 5. <strong>Data</strong> from<br />
the server is SDATA when sequenced. UDATA may be from another <strong>LINX</strong> or the<br />
server.<br />
<strong>LINX</strong> status Messages: These are SDATA records from the <strong>LINX</strong> which have a<br />
transaction number of 0. These can be generated by <strong>LINX</strong> ¾’s on a SubNetork. A<br />
<strong>LINX</strong> 5 can send ‘ON’, ‘MO’, ‘ER’, and ‘ND’ status messages.<br />
NETWORK Directives: These are commands or requests for information send by a<br />
server. These include, but are not limited to:<br />
+xxxxx… File directive<br />
>,xxxxx… Basic pcode download<br />
>Sxxxxx… operating system download record<br />
>>G restart an aborted Basic program<br />
>>A abort a Basic program<br />
NETWORK Directives replies: These are actually ‘ND’ LDATA STATUS records<br />
that the <strong>LINX</strong> sends in response to Network requests.<br />
TEST Record: This is a TEST broadcast packet that the <strong>LINX</strong> sends when it is in<br />
Ethernet Block Transmit mode. The packet is of the form:<br />
“..aaaaaaaaaaaaa ssssssss eeeeeeee hhmmssnnyymmddw”<br />
The “aaaaaaaaaaaa” is the hex ethernet address of this <strong>LINX</strong>. The “ssssssss” is a 32<br />
bit hex record count which starts at 0 every time the test starts. The “eeeeeeee” is a<br />
32 bit hex error count that increments every time there is a collision. The<br />
“hhmmssnnyymmddw” is the time/data stamp.<br />
8 • <strong>LINX</strong> 5 <strong>API</strong>-C <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong>
This test can be started by a server by broadcasting a’ >B’ network directive. The<br />
directive can have an optional argument that is the number of 100ths of a second to<br />
wait between transmits. By default the <strong>LINX</strong> sends once a second.<br />
The network directive ‘>A’ terminated the block transmit test.<br />
The Ethernet Block Receive diagnostic will count the number of test records<br />
received. They are otherwise ignored.<br />
Linx Network Architecture Packet<br />
This packet structure is adapted from one in use on <strong>LINX</strong> 2, 3, and 4 terminals for<br />
RS 485 and RS 232 communications.<br />
The initial release of the<br />
<strong>LINX</strong> 5 does not support<br />
subnetworked <strong>LINX</strong> 3s and<br />
4s. The server should set<br />
Master and Station to 0.<br />
Position Field Explanation<br />
0 <strong>Data</strong> Size: xx Number of bytes of <strong>Data</strong> (may be o)<br />
1 Master: xx Concentrator/Master<br />
2 Station: xx Terminal number that is responding<br />
3 Retries: xx Total retry count<br />
4 Sequence: xx Record sequence number<br />
5 Type: xx Transaction number or block type<br />
6 <strong>Data</strong>: xx 0to 248 bytes of data<br />
<strong>Data</strong>Size: This is the number of valid characters (usually ASCII) in the Application<br />
<strong>Data</strong> Packet.<br />
Master: This field may be 00 for records received from the server. The <strong>LINX</strong> 5<br />
places it own Terminal Numer in this field for records that it generates.<br />
If the <strong>LINX</strong> 5 is forwarding records fro a <strong>LINX</strong> 3 or 4 attached to a subnetwork then<br />
this may be set to the terminal number of an attached SubMaster. If the server is<br />
sending records to Subnetworked <strong>LINX</strong> terminals then this must be set to the<br />
Terminal Number of an attached SubMaster.<br />
Station: This field may be 00 for records received from the server. The <strong>LINX</strong> 5<br />
places its own Terminal Number in this field for records that it generates.<br />
If the <strong>LINX</strong> 5 is forwarding records from a <strong>LINX</strong> 3 or 4 attached to a subnetwork<br />
then this may be set to the terminal number of an attached SubMaster. If the server<br />
is sending records to Subnetworked <strong>LINX</strong> terminals then this must be set to the<br />
Terminal Number of an attached SubMaster.<br />
Retries: This field is set to 0 for each new record generated. It is incremented by<br />
the <strong>LINX</strong> 5, each time the record fails to receive an ACK from the server or when 16<br />
collisions force the <strong>LINX</strong> to back off. The server can use this to keep track of<br />
network problems.<br />
The server sets this to 0 in records it generates. It is ignored by the <strong>LINX</strong> 5.<br />
<strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> 5 <strong>API</strong>-C <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> • 9
If the <strong>LINX</strong> has not yet<br />
received an ACK to a<br />
packet that it has sent then<br />
it will simply ignore any<br />
DATA sent by the server<br />
until the data has been sent<br />
successfully. It is thus the<br />
server’s responsibility to<br />
accept data whenever the<br />
<strong>LINX</strong> has sent it. It is also<br />
the servers responsibility to<br />
insure that it has received<br />
an ACK to every DATA<br />
packet that it sends.<br />
Sequence: The sequence number is used to maintain an orderly flow of sequenced<br />
data. For each LDATA record generated by the <strong>LINX</strong>, the sequence number is<br />
incremented when a positive acknowledge Type=’g’ is received that has the same<br />
sequence number.<br />
Sequence numbers are 1 to 99. Any LDATA reeived by the server with a sequence<br />
of 1 to 99 requires an ACK before the <strong>LINX</strong> will send the next record. If the server<br />
fails to respond within the slave timout then the record will be resent.<br />
The server should increment the sequence number for each packet sent to the <strong>LINX</strong>.<br />
The <strong>LINX</strong> will respond with an ACK to each DATA packet.<br />
The server sends a POLL packet with a sequence number of 0 to a specific <strong>LINX</strong><br />
(not a broadcast packet) to cause that <strong>LINX</strong> to come ONLINE. This tells the <strong>LINX</strong><br />
that there is a valid server which is waiting to receive packets. The <strong>LINX</strong> responds<br />
with a Type 0, sequence 0, ‘ON’ status packet.<br />
Type: This is the packet type.<br />
ASCII ‘p’ POLL packets (used to bring <strong>LINX</strong> on line)<br />
ASCII ‘g’ ACK type packet<br />
ASCII ‘x’ SDATA is a sequenced data packet from the server<br />
ASCII ‘u’ UDATA is unsequenced data from a <strong>LINX</strong> or server<br />
ASCII ‘s’ SERVER AVAILABLE<br />
ASCII ‘q’ SERVER UNAVAILABLE<br />
ASCII ‘l’ <strong>LINX</strong> AVAILABLE<br />
ASCII ‘t’ TEST record<br />
BINARY 0 to 99 LDATA sequenced data packet from the <strong>LINX</strong> <strong>Data</strong> <strong>Terminals</strong><br />
BINARY 0 LDATA STATUS data packet from the <strong>LINX</strong> <strong>Data</strong> <strong>Terminals</strong><br />
Linx 5 Full Server Implementation<br />
A <strong>LINX</strong> 5 Server is an application program that executes on a host computer.<br />
NetLIO is an example of a server. A full server is one that performs sequenced IO<br />
with each <strong>LINX</strong>. The server starts and stops in an orderly manner which makes it<br />
easy for the BASIC applications to know that there is a program that is accepting<br />
data or processing transactions.<br />
A full server maintains a table of all <strong>LINX</strong>’s that it has communicated with since it<br />
began its operation. It may also have a table saved in a file to be sure that the<br />
network it expects is present.<br />
The server must maintain a transmit and receive packet sequence number for each<br />
<strong>LINX</strong>. When the server receives a second copy of a record from a <strong>LINX</strong> (as<br />
indicated by a duplicated receive sequence #) then it should ACK the record and<br />
discard it. This prevents reception of duplicate data when there are a lot of collisions<br />
and undeliverable packets on the network.<br />
10 • <strong>LINX</strong> 5 <strong>API</strong>-C <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong>
Normal operation of a full server works like this:<br />
1) A server broadcasts SERVER AVAILABLE. This is how the <strong>LINX</strong> determines<br />
an address to send data to.<br />
2) The <strong>LINX</strong> 5’s reply with <strong>LINX</strong> AVAILABLEs to the server’s address. This<br />
gives the server an address for each <strong>LINX</strong> in the network.<br />
3) The server sends a POLL to each of the specific <strong>LINX</strong>’s and receives an ‘ON’<br />
LDATA STATUS message. The server sends ACK. This causes each <strong>LINX</strong>’s<br />
to come ONLINE since now it is certain that the server has received a valid<br />
address.<br />
4) <strong>LINX</strong> 5’s send LDATA to the server as it becomes available. The server replies<br />
with ACK to each packet received.<br />
5) The server sends SDATA to the <strong>LINX</strong>’s. If the server fails to receive an ACK<br />
from a <strong>LINX</strong> then it should resend the data. If the server receives an LDATA<br />
block from the <strong>LINX</strong> then it should ACK the block before attempting to resend<br />
the data block.<br />
6) Periodically (once every 30 seconds) the server should send a SERVER<br />
AVAILABLE. If a <strong>LINX</strong> fails to receive either a data block or a SERVER<br />
AVAILABLE for 60 seconds then it will go OFFLINE.<br />
7) When the server terminates it broadcasts SERVER unavailable a few times.<br />
This causes all <strong>LINX</strong> to immediately assume the OFFLINE state.<br />
Note that if the <strong>LINX</strong> receives a UDATA block then it will immediately send it to<br />
the application program if the buffer is free. If there is no place to put the data, it is<br />
ignored. UDATA is not ACKed. UDATA does not assure delivery so it should only<br />
be used in peer to peer applications where the application programs are assuring that<br />
the data gets handled properly.<br />
Linx 5 Limited Server Implementation<br />
Limited servers are very simple. A limited server sends and receives only UDATA<br />
packets. The limited server needs to have the full network address of each <strong>LINX</strong><br />
that it needs to communicate with stored in a table somewhere. The BASIC<br />
applications send only UDATA packets to the NET device using the network address<br />
obtained from UDATA received from the server.<br />
Since it is entirely the application programs responsibility to assre correct<br />
transmission of data, there is no handshaking at the <strong>LINX</strong> protocol level.<br />
Alternate Servers<br />
An Alternate Server just waits around and listens to the network. If more than 65<br />
seconds goes by without the alternate receiving a Server Available broadcast, then<br />
the Main Server is probably down (or the Server Available messages are lost due to<br />
network traffic or signal noise problems). The alternate server can then begin<br />
operation as a main server.<br />
<strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> 5 <strong>API</strong>-C <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> • 11
If a Main Server wants to take over operation from an alternate server then it should<br />
start out by listening to the network for up to 65 seconds. If an alternate server is not<br />
detected then it can begin normal operation. If an alternate server is detected then<br />
the main takes control by:<br />
1. Sending a direct POLL to the alternate server.<br />
2. Receiving an ACK from the alternate server.<br />
3. Issuing broadcast Server Unavailables.<br />
4. Starting as a normal server.<br />
<strong>LINX</strong> 5 IPX Packet<br />
The IPX Packet is structured as follows:<br />
Position Field Value<br />
0 CheckSum: FF FF<br />
2 Length: xx xx<br />
4 Transport Control: 00<br />
5 PacketType: 04<br />
6 Destination Network: xx xx xx xx<br />
10 Destination Node: xx xx xx xx xx xx<br />
16 Destination Socket : xx xx<br />
18 Source Network : 00 00 00 00<br />
22 Source Node : xx xx xx xx xx xx<br />
28 Source Socket : xx xx<br />
30 LNA Packet : 13 to 254 bytes of data<br />
CheckSum: Set to FFFFand not used.<br />
Length: This is 30+ the size of the <strong>LINX</strong> Packet. AS with all two byte values in the<br />
packet, this is in MSB, LSB order (the opposite of the x86 standard).<br />
Transport Control: Set to 0. May be set to a non-zero value on packets routed by a<br />
file server.<br />
Packet Type: This is 4 for IPX communications. Records received from the server<br />
may have a different value. This is ignored by the <strong>LINX</strong>.<br />
Destination Network: The <strong>LINX</strong> sets this to 0 for peer/peer packets. If this is a<br />
reply to a packet from the server this will be set to the servers network number.<br />
Novell uses network numbers of 1, 2, 3… for each physical network attached to a<br />
given set of file servers.<br />
Destination Node: Same as the Ethernet address. Set to FFFFFFFFFFFF for<br />
broadcast packets.<br />
Destination Socket: The <strong>LINX</strong> will IGNORE any packets that do not have the same<br />
socket that is defined in the System Menu.<br />
12 • <strong>LINX</strong> 5 <strong>API</strong>-C <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong>
NOTE: <strong>LINX</strong> will contact NOVELL and obtain one or more permanent socket<br />
assignments. Novell assigns sockets starting at 8000h and going up. The NOVELL<br />
shell randomly assigns sockets from 4000-7FFF when an OPEN SOCKET request<br />
is made that does not ask for a specific set of socket numbers. We will try to get 8<br />
numbers.<br />
The default <strong>LINX</strong> 5 socket number is currently CC D8 (where CC is the MSB).<br />
Source Network: The <strong>LINX</strong> sets this to 0. Packets received from a host will have a<br />
network address which must be used during replies to the host.<br />
Source Socket: When the <strong>LINX</strong> receives packets from a server this may be any<br />
value. The <strong>LINX</strong> always replies to the server using the full 12 byte (Network, Node,<br />
Socket) address that the server used in its last accepted packet.<br />
<strong>LINX</strong> 5 LLC Packet Structure<br />
Position Field Value<br />
0 DSAP: EO<br />
1 SSAP: EO<br />
2 Control: 03<br />
3 IPX <strong>Data</strong>: 43 to 576 bytes of data<br />
DSAP: Destination Service Access Point. This is always EO for IPX and XNS<br />
protocols.<br />
SSAP: Source Service Access Point. This is always EO for IPX and XNS protocols.<br />
Control: This is 03 for UI (unnumbered information) packets. All <strong>LINX</strong> packets are<br />
UI. See 802.2 LLC Description for more info. Note that if the low order bits are<br />
xxxxxxx0 or xxxxxx01 then there is a second byte to the control field.<br />
<strong>LINX</strong> 5 Ethernet Packet Structure<br />
The <strong>LINX</strong> 5 supports the full set of Ethernet frame types. These are Ethernet II,<br />
IEEE 802.2, IEEE 802.3 with SNAP, and Novell 802.3. The following illustrates the<br />
Novell IEEE 802.3 compatible frames. These differ only slightly from other<br />
“Ethernet” frames.<br />
Each frame contains octets (bytes) which are received least significant bit first.<br />
When these are shown as hex, the least significant digits will be on the right. When<br />
a 16 bit or larger value is used, the most significant octet is received first. This is the<br />
opposite of the method used by the x86 family.<br />
<strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> 5 <strong>API</strong>-C <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> • 13
Each frame consists of:<br />
Position Field Value<br />
-8 Preamble: 55 55 55 55 55 55 55<br />
-1 SFD: D5<br />
0 Destination: xx xx xx xx xx xx<br />
6 Source : xx xx xx xx xx xx<br />
12 Length : xx xx<br />
14 LLC <strong>Data</strong> : 46 to 579 bytes of data<br />
n FCS : xx xx xx xx<br />
Preamble : Hardware generated and checked<br />
SFD: Start Frame Delimiter, hardware generated and checked<br />
Destination address: 6 bytes MSB first. An address of FF FF FF FF FF FF is a<br />
broadcast address that will be received by all NICs that have broadcast accept<br />
enabled.<br />
I/G bit: The first byte (MSB) uses the least significant bit (bit 0) for<br />
Individual/Group multicast addressing. The <strong>LINX</strong> always sets this bit to 0 except<br />
during tests when it uses the broadcast address.<br />
U/L bit: Bit 1 is used for Universal/Local address administration. The <strong>LINX</strong> sets<br />
this bit to 1 for software addressing. NOTE: At some future time <strong>LINX</strong> may begin<br />
using IEEE assigned addresses burned into ROM. At that time the user will no<br />
longer be allowed to enter or modify the <strong>LINX</strong> address.<br />
I/G (bit 0) = 0 Individual Address<br />
I/G (bit 0) = I Group Address<br />
U/L (bit 1) = 0 Globally administered (IEEE) address<br />
U/L (bit 1) = 1 Locally administered address<br />
On the <strong>LINX</strong>, there are 2 System Menu parameters that are used to compose the<br />
Ethernet address. These are the “Terminal Number” and the “Ethernet Address”<br />
fields. The Terminal Number is a decimal value from 1 to 99. It is placed into the<br />
6 th byte of the address. The first 5 bytes of the address are derived from the hex<br />
Ethernet Address field.<br />
Source Address: 6 bytes MSB first. Same format as Destination.<br />
Length: the number of bytes in the LLC <strong>Data</strong> field. MSB first.<br />
FCS: Frame check sequence. A 32 bit CRC checked by hardware.<br />
14 • <strong>LINX</strong> 5 <strong>API</strong>-C <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong>
Appendix A<br />
The Whole Packet<br />
-8 ENET -8 Preamble: 55 55 55 55 55 55 55<br />
-1 ENET -1 SFD: D5<br />
0 ENET 0 Destination: xx xx xx xx xx xx<br />
6 ENET 6 Source: xx xx xx xx xx xx<br />
12 ENET 12 Length: xx xx<br />
14 ENET 14 LLC <strong>Data</strong>: 46 to 287 bytes of data<br />
14 LLC 0 DSAP: E0<br />
15 LLC 1 SSAP: E0<br />
16 LLC 2 Control: 03<br />
17 LLC 3 IPX <strong>Data</strong>: 43 to 284 bytes of data<br />
17 IPX 0 CheckSum: FF FF<br />
19 IPX 2 Length: xx xx<br />
21 IPX 4 Transport Control: 00<br />
22 IPX 5 PacketType: 04<br />
23 IPX 6 Destination Network: xx xx xx xx<br />
27 IPX 10 Destination Node: xx xx xx xx xx xx<br />
33 IPX 16 Destination Socket: xx xx<br />
35 IPX 18 Source Network: 00 00 00 00<br />
39 IPX 22 Source Node: xx xx xx xx xx xx<br />
45 IPX 28 Source Socket: xx xx<br />
47 IPX 30 LNA Packet: 13 to 254 bytes<br />
47 LNA 0 <strong>Data</strong>Siza: xx Number of bytes of <strong>Data</strong> (may be 0)<br />
48 LNA 1 Master: xx Concentrator/Master<br />
49 LNA 2 Station: xx Terminal number that is responding<br />
50 LNA 3 Retries: xx Total retry count<br />
51 LNA 4 Sequence: xx Record sequence number<br />
52 LNA 5 Type: xx Transaction number or block type<br />
53 LNA 6 <strong>Data</strong>: xx 0 to 248 bytes of data<br />
<strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> 5 <strong>API</strong>-C <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> • 15
53 APP The application data can be status messages<br />
54 APP such as ERROR, ON, OF, MO, ND. It can be network<br />
55 APP Directives such as S. If there are less than<br />
57 APP 7 bytes of data then this is padded with 0s.<br />
58 APP The application data is always followed by two<br />
59 APP termination bytes: 7E then 00.<br />
60 ENET n FCS: xx xx xx xx<br />
16 • <strong>LINX</strong> 5 <strong>API</strong>-C <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong>
Net <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong><br />
<strong>Guide</strong><br />
Function List<br />
Include File:<br />
NetAvail<br />
NetFlush<br />
NetRead<br />
NetOpen<br />
NetClose<br />
NetErr<br />
NetErrText<br />
Defines.h<br />
Net<strong>API</strong>.h<br />
: TRUE when packet is available for reading<br />
: Discards all unread packets<br />
: Reads a pending packet<br />
: Opens the NET <strong>API</strong> and sets its parameters<br />
: Closes the <strong>API</strong><br />
: Returns the last error code<br />
: Returns the last error code and text<br />
: Required include files and constants<br />
: Function declarations<br />
<strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> Net <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> • 17
Overview<br />
This simple <strong>API</strong> (Applications Program Interface) is used to perform simple network<br />
communications. The NetOpen routine is optionally called to set the size and<br />
number of receive buffers, as well as the sockets used for send and receive. If it is<br />
omitted then defaults will be used.<br />
Reading should consist of calling NetAvail until TRUE. A call to NetRead will<br />
obtain the data and where it came from (NetAddress). Note that reading is always in<br />
progress and can occur in any order. The order with which records are fetched from<br />
NetRead may not correspond to the order in which they were sent.<br />
NetWrite will send a record to another computer.<br />
If any routine has an error, the text description of that error can be obtained with<br />
NetERRText. If you only need the non-zero error code then call NetErr.<br />
You MUST call NetClose before exiting your program. Failure to do so may leave<br />
network resources unavailable for the next time you run the program.<br />
Predefined Types<br />
The standard unsigned types are:<br />
BOOL unsigned int<br />
WORD unsigned int<br />
BYTE unsigned char<br />
DWORD unsigned long<br />
The Motorol Format (MSB First) swapped types are:<br />
XBYTE, XWORD, and XDWORD<br />
The Net Addresses are supplied in:<br />
Typedef struct {<br />
XDWORD Network, //Cabling system # of a network<br />
XBYTE Node [6]. // Actual card address<br />
XWORD Socket; // Socket number<br />
] NetAddress:<br />
Function: NetAvail ( )<br />
Usage: This is called to find out if there is any pending receive blocks<br />
Returns: TRUE if a block is available for reading<br />
Proto: BOOl Net Avail (void)<br />
Function : NetWrite ( &NetAddress, &data, n)<br />
18 • Net <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong>
Function: NetFlush ( )<br />
Usage: Clears (discards) any pending receive blocks.<br />
Proto: void NetFlush(void)<br />
Function: NetRead( &NetAddress, &data, n)<br />
Usage: If there is no block available for reading then this will wait until one is. Use<br />
NetAvail to check for block availability. The source address of the data is placed in<br />
NetAddress. The packet data is copied to the data buffer for a maximum of n bytes.<br />
It is null terminated by NetRead so n must be 1 less than the actual buffer size. If n<br />
is 0 then the buffer is assumed to be large. If n,0 then the packet will be ignored<br />
(flushed).<br />
Returns: # bytes read or 0 if an error occruured.<br />
Proto: int NetRead (NetAddress* s, BYTE*d, int nmax)<br />
Function: NetWrite (&NetAddress, &data, n)<br />
Usage: Writes a block (data) of n bytes to the network.<br />
In NetAddress:<br />
The Node must be set to the correct destination node. This is a six byte long LSB<br />
first value.<br />
Network must be set to 0 for the local network. This is a LSB first format unsigned<br />
long value.<br />
The Socket is not used (it defaults to the source socket).<br />
Returns: TRUE if the packet was sent successfully.<br />
Proto: BOOL NetWrite (NetAddress* a, BYTE*d, int n)<br />
Function: NetOpen (buffersize, count, ssocket,<br />
dsocket)<br />
Usage: Initializes the network facility. This is optionally called to allocate Receive<br />
buffers and Socket numbers. NetOpen will always return TRUE after the first<br />
successful allocation. Use 0 for any parameter that should default.<br />
Returns: TRUE if successful.<br />
Proto: BOOL NetOpen (WORD bufsize, WORD bufcnt, WORK ssocket, WORD<br />
dsocket)<br />
Function: NetClose ( )<br />
Usage: Releases the sockets and buffers Must be called for normal termination.<br />
Proto: void NetClose (void)<br />
<strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> Net <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> • 19
Function: NetErr ( )<br />
Usage: Returns the last error code<br />
Proto: WORD NetErr (void)<br />
Function NetErrText (&string)<br />
Usage: Returns the last error code and its text description<br />
Proto: WORD NetErrTest (char*txt)<br />
20 • Net <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong>
<strong>LINX</strong> 5 DOS Utilities Users <strong>Guide</strong><br />
Program List<br />
L5List.exe<br />
: List the <strong>LINX</strong> 5’s on the network<br />
L5Chat.exe : Direct interaction with <strong>LINX</strong> 5’s<br />
L5Load.exe : Download files to one or more <strong>LINX</strong> 5’s<br />
L5Go.exe<br />
: Start a loaded Basic application<br />
L5Abort.exe : Stop an executing Basic application<br />
Close.exe<br />
: Close an open socket<br />
Each DOS utility accepts switch of /? to get a list of command line parameters.<br />
L5List.exe : List the <strong>LINX</strong> 5’s on the network<br />
L5List/flags<br />
/D : show <strong>LINX</strong> Display<br />
/C : display all packets<br />
/R : display all received packets<br />
/T : display all transmit packets<br />
/V : show software version in units<br />
/S : show the server status<br />
/P : suppress headings<br />
<strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> 5 DOS Utilities Users <strong>Guide</strong> • 21
L5Chat.exe : Direct interaction with <strong>LINX</strong> 5’s<br />
L5Chat/flags<br />
/C : display all packets<br />
/R : display all received packets<br />
/T : display all transmit packets<br />
/P : suppress headings<br />
/F : always chat with the first unit<br />
/S : suppress headings<br />
/X : always show the unit table<br />
/D : suppress display of file while sending<br />
Allows you to directly enter commands for a single <strong>LINX</strong> 5 terminal on the network<br />
and see the response.<br />
L5Load.exe : Download files to one or more <strong>LINX</strong><br />
5’s<br />
L5Load filename/flags<br />
/Q : quiet mode<br />
/C : display all packets<br />
/F : load only the first terminal<br />
/S : load a selected terminal<br />
/X : show the unit table<br />
/O : load the operating system<br />
/D : display file while sending<br />
/W : don’t wait a few seconds after loading<br />
/B : show End by SYSTEM messages<br />
Loads a file to one or more <strong>LINX</strong> 5 terminals.<br />
Environmental variables:<br />
L5OS = default operating system to load.<br />
L5LXE = default LXE basic file to load<br />
22 • <strong>LINX</strong> 5 DOS Utilities Users <strong>Guide</strong> <strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong>
L5Go.exe : Start a loaded Basic application<br />
L5Go/flags<br />
/Q : quiet mode<br />
/C : display all packets<br />
/F : run only the first terminal<br />
/S : run a selected terminal<br />
/X : show the unit table<br />
L5Abort.exe : Stop an executing Basic application<br />
L5Abort/flags<br />
/Q : quiet mode<br />
/C : display all packets<br />
/F : abort only the first terminal<br />
/S : abort a selected terminal<br />
/X : show the unit table<br />
/O : kill the operating system and reboot<br />
/W : don’t wait for reboot to complete<br />
Close.exe : Close an open socket<br />
If a program aborts during operation or if control-Break is pressed then an Ipx socket<br />
is left open. Use close to force it closed.<br />
<strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> 5 DOS Utilities Users <strong>Guide</strong> • 23
<strong>LINX</strong> 5 Network Activity Statistics<br />
Introduction<br />
Here we examine the network load presented by <strong>LINX</strong> 5 terminals in a number of<br />
different circumstances. Lets first examine the nature of Ethernet networks. By<br />
definition, traditional Ethernet networks have a data rate of 10 million bits per<br />
second.<br />
This means that around 1 million bytes (characters) can be sent on the network every<br />
second (actually this is 1.25 mb/s, but lets be conservative). Now an additional limit<br />
says that every network packet must be at least 64 bytes long. This means that<br />
around 15,000 minimum size packets can be sent every second.<br />
Since virtually every interaction consists of both a REQUEST packet and a<br />
RESPONSE packet, this gives us 7,500 INTERACTIONS per second as the absolute<br />
maximum number of actions that can occur on an Ethernet REGARDLESS of the<br />
type of computers being used.<br />
The MAXIMUM packet size is 1514 bytes (for ETHERNET). This is far more than<br />
the 100 byte maximum the <strong>LINX</strong> imposes. (Note the 1514 limit gives you a 660<br />
packets/sec max). Novell imposes a more limited length of 576 byte which is 1700<br />
packets/second.<br />
After factoring in the various network packet headers for the networks the <strong>LINX</strong><br />
operates under, we find that ONLY 6 bytes are left for actual <strong>LINX</strong> application data<br />
in each packet that is sent or received of the MINIMUM size.<br />
Passive Loading<br />
Definition: The amount of traffic presented by <strong>LINX</strong> terminals when they are not in<br />
use by any <strong>LINX</strong> server<br />
Percentage: 0%<br />
Reason: Unless a SERVER presents either BROADCAST or SPECIFIC polls then<br />
NO <strong>LINX</strong> will respond or affect traffic. The <strong>LINX</strong> NEVER issues a broadcast<br />
packet.<br />
24 • <strong>LINX</strong> 5 Network Activity Statistics <strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong>
Inactive Loading<br />
Definition: A <strong>LINX</strong> Server program is running on one or more host computers on<br />
the network. No <strong>LINX</strong> 5 is being sent data, and no data needs to be sent to the <strong>LINX</strong><br />
5’s.<br />
Percentage: 0.007% per <strong>LINX</strong> 5 terminal<br />
0.667% for 100 <strong>LINX</strong> 5 terminals<br />
6.677% for 1000 <strong>LINX</strong> 5 terminals<br />
Reason: Each <strong>LINX</strong> is polled by the server once every 30 seconds. In addition,<br />
every 30 seconds a BROADCAST server available message is sent to discover any<br />
<strong>LINX</strong>es that have just been added to the network. From out introduction we see that<br />
the percent of use is 100 * (n 1/7500 + 1/15000), where n is the number of <strong>LINX</strong><br />
terminals on the net.<br />
Active Loading<br />
Definition: Here we assume that the terminals are used in some for of database<br />
activity with the host network system(s). Our worst case scenario is individual<br />
database lookups for each employee while clocking in or out. Note that we have<br />
already observed that the MINIMUM 64 byte network packet gives us 6 bytes of<br />
EMPLOYEE number data from the employee card without sending more than the<br />
minimum packet length. Now lets assume that to clock in an employee requires a<br />
full 100 data bytes from the data base. Now during peak activity, lets examine<br />
network loading…<br />
Percentage: 0.2% = 1 employee/sec with 1 <strong>LINX</strong> ** (See note)<br />
= 3600 employees per hour ** (See note)<br />
Percentage: 0.2% = 3 <strong>LINX</strong>es/employee/sec<br />
= 3600 employees per hour – NO PROBLEM<br />
Percentage: 0.6% = 10 <strong>LINX</strong>es/employee/sec * (See note)<br />
= 10000 employees per hour<br />
Reason(s)<br />
** It is unlikely that a <strong>LINX</strong> can actually handle 1 employee per second.<br />
Examination of actual applications shows that in even the simplest swipe badge and<br />
walk on systems, between 3 and 6 seconds should be allowed per scan. This is due<br />
to the empirical problem of moving people past a fixed station. In addition, host<br />
database systems may have problems with more than one or two accesses per<br />
second.<br />
* As a rule of thumb, we advise that if you have 1000 employees who must clock in<br />
or out in a 15 minute period then you will need 5 terminals. The faster you need to<br />
process each person, the more terminals you will need.<br />
<strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> 5 Network Activity Statistics • 25
Conclusion<br />
From the above, it is obvious that even a large <strong>LINX</strong> network does not represent a<br />
significant load on an Ethernet system. The fact that every 30 seconds, the <strong>LINX</strong><br />
Server program issues a SERVER AVAILABLE message should not be a cause for<br />
concern.<br />
As a thought experiment, The number of <strong>LINX</strong>es needed to use 50% of the network<br />
bandwidth (assuming that every <strong>LINX</strong> needs to perform ONE transaction (request<br />
and response) with the host computer every second) is more than 3000 units ON A<br />
SINGLE NETWORK. This should be considered an unreasonably huge number.<br />
26 • <strong>LINX</strong> 5 Network Activity Statistics <strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong>
<strong>LINX</strong> V <strong>API</strong> <strong>Programmers</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>LINX</strong> 5 Network Activity Statistics • 27