Does xinetd preserve data integrity?

105 views Asked by At

Background info:

I have a page written in php that sends data to another server, like so:

$url = "example=data&to=show&the=format&im=using";
$client = stream_socket_client("<IP address and port>", $errno, $errorMessage);
fwrite($client, $url . "\n");

The server on the receiving end uses xinetd to launch a script that does the actual processing. Its config is like this:

service b2b
{
    socket_type = stream
    protocol = tcp
    wait = no
    user = root
    server = /bbj/bin/bbj
    server_args = -c/samuel/config.daemon -q SS0B2R - system /tmp
    groups = yes
    disable = no
    per_source = UNLIMITED
    instances = UNLIMITED
    flags = NODELAY KEEPALIVE
}

Question: Let's say there is some sort of catastrophe, like someone pulls out the ethernet cable, is it possible for the script to only receive a portion of the string? Ie: example=data&to=sh

1

There are 1 answers

1
Petr Duchek On

It's not about xinetd, it's about protocol.

If you use TCP like stream_socket_client("tcp://www.example.com:80", $errno, ... everything is OK.

TCP is a reliable stream delivery service that guarantees that all bytes received will be identical with bytes sent and in the correct order. Since packet transfer over many networks is not reliable, a technique known as positive acknowledgment with retransmission is used to guarantee reliability of packet transfers. This fundamental technique requires the receiver to respond with an acknowledgment message as it receives the data. The sender keeps a record of each packet it sends. The sender also maintains a timer from when the packet was sent, and retransmits a packet if the timer expires before the message has been acknowledged. The timer is needed in case a packet gets lost or corrupted