خرید بک لینک

I use socat 1.7.3.1-r0 and run following command on an alpine 3.3 linux server:

socat -d -d -d PTY,link=/dev/ttyFOOBAR,echo=0,raw,unlink-close=0 TCP-LISTEN:7000,forever,reuseaddr

Socat will listen for clients and create a bidirectional communication by passing data from the virtual serial port /dev/ttyFOOBAR to the client and back again over TCP. Once the client discoects socat should exit.

When such a coection is established socat logs the following:

I socat by Gerhard Rieger - see www.dest-unreach.org
I This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)
I This product includes software written by Tim Hudson (tjh@cryptsoft.com)
I setting option "symbolic-link" to "/dev/ttyFOOBAR"
I setting option "echo" to 0
I setting option "raw"
I setting option "unlink-close" to 0
I openpty({5}, {6}, {"/dev/pts/3"},,) -> 0
N PTY is /dev/pts/3
I setting option "forever" to 1
I setting option "so-reuseaddr" to 1
I socket(2, 1, 6) -> 7
I starting accept loop
N listening on AF=2 0.0.0.0:7000
I accept(7, {2, AF=2 CLIENT_IP:PORT}, 16) -> 8
N accepting coection from AF=2 CLIENT_IP:PORT on AF=2 172.20.0.2:7000
I permitting coection from AF=2 CLIENT_IP:PORT
I close(7)
I resolved and opened all sock addresses
N starting data transfer loop with FDs [5,5] and [8,8]

ss command on the server prints:

Netid  State      Recv-Q Send-Q Local Address:Port                 Peer Address:Port                
tcp    ESTAB      0      0      172.20.0.2:7000                 CLIENT_IP:PORT

The problem is, that when I discoect the client (by switching it off), the tcp coection is still established and no addition logging is coming from socat. ss still shows the coection as ESTAB. Any ideas why? When I again coect the client following appears in the logs:

W read(8, 0x7fa8f48c4020, 8192): Coection reset by peer
N socket 2 to socket 1 is in error
N socket 2 (fd 8) is at EOF
I poll timed out (no data within 0.500000 seconds)
I close(5)
I shutdown(8, 2)
I shutdown(8, 2): Socket not coected
N exiting with status 0

But why does this happen on coect instead of discoect?

برچسب: نویسنده: استخدام کار تاريخ: جمعه 27 فروردين 1395 ساعت: 16:04

صفحه بندی