O
O
Oleg2020-07-02 10:15:07
PHP
Oleg, 2020-07-02 10:15:07

How to get/transmit information that a network connection is half-closed?

Part of the question to the android guru
I am writing under the android printer emulator. Problem with determining when the client has closed the connection.
Now I'm just waiting for 5 seconds of idle channel.
And I want to immediately detect that the connection is closed on the client side.
Ideally, what is half-closed, i.e. he has completed the transmission and is waiting for a response.

To those who know PHP and/or Node.JS
ps And is it possible to close the connection like this in PHP and NODE ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2020-07-03
@402d

After going through the shutdown options both in PHP and in android, I realized
that the desired result (solution) would not work.
For an Internet socket, the only way to determine that it has closed prematurely is if data has failed to write to it in the opposite direction.
Thus, for unidirectional connections:
a) a known length
b) the signature of the stream termination
c) the FIN bit of the last packet ??? could not find a way to set it or read it through regular abstractions
over a network connection.
So, I implemented sending back several bytes to the stream after reading .
And on eksepshen early termination.
Regular completion remained on the timeout. Nothing received for 5 seconds.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question