Il 30/12/2020 18:55, Björn Lundin ha scritto:
> Den 2020-12-30 kl. 16:19, skrev RobertoA:
>> The Raspberry4 board has 6 native uart
>> How to proceed?
>
> with virtual ports you need commercial drivers.
> I once did a mapping tcp-port serail port in tcl
> ran in a _very_ busy warehouse translating stacker crane protcol
> (3964rk512)
> it ran 12 serial port on an XP at that time (now - new plcs with tcp/ip
> are installed)
>
> it basically looked like
>
>
>
> proc accept {sock addr port} {
> dbg "[gettime] -> start accept from $addr"
>
> if { ! [string equal $addr $::client_ip]} {
> dbg "[gettime] -> wrong client, got '$addr' but accepts only from
> '$::client_ip'"
> catch {close $::ss}
> catch {close $sock}
> set ::done 1 ;# signal to main loop to let go
> return
> }
>
> set ::my_sock $sock
> set ::my_com [open $::tty {RDWR}]
>
> # Read channels w/o buffering and in binary mode
> fconfigure $::my_sock -buffering none -translation binary
> fconfigure $::my_com -mode $::mode -buffering none -translation binary
>
> # Setup handler for communication on the channels
> fileevent $::my_sock readable [list pass_through $::my_sock $::my_com]
> fileevent $::my_com readable [list pass_through $::my_com $::my_sock]
>
> # make sure noone else connects while a session in running
> catch {close $::ss}
> dbg "[gettime] -> stop accept"
> }
>
>
>
> loop to reopen the listening socket when connection down
> while {1} {
> dbg "[gettime] -> Start listening"
> set ss [socket -server accept $port]
> vwait done ; # wait until the connection is closed
> # clean up after session
> dbg "[gettime] -> Close this session"
> catch {close $::my_com}
> catch {close $::my_sock}
> }
>
> there where som config files and some whitelist involved as well, but
> above is the essence of it
>
>
>
> its usefull, if you connect the pi with your serial device, and the
> conect the PC to the pi via a simple socket.
>
I cannot fully understand how to use the example code described, but it
seems to me very useful to realize what I would like to achieve
How to use this code on Raspberry board?
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|