If there are 3 machines A, B and C and A communicate directly with B (A -> B) but B is executing port fordwarding with the next command

socat TCP4-LISTEN:443,fork TCP4:<ip machine C>:443

So in fact the communication is A -> B -> C. Is there any way that A could know it is really communicating with C?

  • Are you asking about the specific command or the port forwarding concept?
    – allo
    May 5, 2022 at 14:17
  • Both xd. I mean, I need the command but I do not really know if this is possible in a conceptual level
    – P00
    May 5, 2022 at 14:21
  • For the concept the receiver doesn't have any hints about if the data is generated by a program like a webserver or forwarded from another network connection by a program like socat. On the other hand, socat may have specific characteristics one might be able to detect that socat is used. Still I would doubt if you can detect if it forwards data over a network or, e.g., using a pipe.
    – allo
    May 5, 2022 at 14:30
  • Ok. I've been focusing more at the network level and I tryed traceroute to see if this way I could show the B machine is only a redirector but it doesn't work so meaby you are right.
    – P00
    May 5, 2022 at 14:34
  • Traceroute won't help you, because with socat there is a "non-network" hop in your connection and traceroute cannot trace the forwarding through the program. The best you can hope for is determining that socat is listening on the port and forwarding something (e.g. by characteristic use of TCP-flags, latency, etc.) but you cannot trace the further path.
    – allo
    May 5, 2022 at 14:36

1 Answer 1


No, it's not possible to A to know if B is forwarding packets to C or not.

As soon as the packets reach B, A does not have any visibility on them. B will send the packet data to C, not the packets themselves. When a packet reaches B coming from C, B will read the packet, get its data, and send the data to A.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .