set Handle [socket 10.167.145.54 23]
puts [gets $Handle]
puts $Handle "ls"; flush $Handle
puts [gets $Handle]
close $Handle
под strace:
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 5
fcntl(5, F_SETFD, FD_CLOEXEC) = 0
getsockopt(5, SOL_SOCKET, SO_SNDBUF, [16384], [4]) = 0
getsockopt(5, SOL_SOCKET, SO_RCVBUF, [87380], [4]) = 0
connect(5, {sa_family=AF_INET, sin_port=htons(23), sin_addr=inet_addr("10.167.145.54")}, 16) = 0
lseek(0, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
lseek(1, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
lseek(2, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
ioctl(2, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(2, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
recvfrom(5, "\377\375\1\377\375\37\377\373\1\377\373\3", 4096, 0, NULL, NULL) = 12
recvfrom(5, "\r\r\n", 4084, 0, NULL, NULL) = 3
write(1, "\303\277\303\275\1\303\277\303\275\37\303\277\303\273\1\303\277\303\273\3\r\n", 22ÿýÿýÿûÿû
) = 22
sendto(5, "ls\r\n", 4, 0, NULL, 0) = 4
write(1, "\r\n", 2
) = 2
close(5)