Sample PDL device definition for a TCP driver

TCP clients and servers basically look the same. The only difference in addition to the type: value is that a TCP client supplies a value for host:.

For example:

define device;
type: tcp-client;
port: port-num;
host: server-host
end device;
  • For TCP drivers, port-num specifies the TCP port number for the connection. This must be an integer constant or an identifier which names a TCP port. For example, /etc/services.
  • For TCP clients, server-host indicates to which machine a connection is attempted. In this case, use an identifier or string.

Example

The device definitions for a driver pair might resemble this:

  • The server, on host foo.bar.com:
    define device;
    type: tcp-server;
    port: 4401;
    end device;
  • The client, elsewhere:
    define device;
    type: tcp-client;
    port: 4401;
    server: "foo.bar.com";
    end device;
  • If the client is in the same domain and port 4401 is known by the name the service, then:
    define device;
    type: tcp-client;
    port: the service;
    server: foo; 
    end device;
    Note: In PDL keyword-value type constructs, supply an identifier where a string is expected. In this example, this is the value of the host and port name.