rvlahov has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use IO::Socket; use Win32::SerialPort qw( :STAT 0.19); my $Configuration_File_Name; my ($SerialPortObj, $PortName, $quiet); my $element; $Configuration_File_Name = 'c:\rvp\io-test\io-test.config'; $PortName = 'COM1'; $SerialPortObj = Win32::SerialPort->start($Configuration_File_Name); $SerialPortObj->debug(0); my $PORT = shift || 2007; my ($sock,$data); my $listen = IO::Socket::INET->new( Listen => 15, LocalPort => $PORT, Reuse => 1)<br> or die "Can't listen (TCP)"; warn "Listening (TCP) on port $PORT...\n"; $sock = $listen->accept; while (sysread $sock,$data,1024) { print "got ",length($data)," bytes of normal data 12-20-02: $data\n" +; $SerialPortObj->write(chr(2) . $data . chr(3)); } __END__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: TCP to Serial and back
by skamerman (Initiate) on Dec 26, 2002 at 20:01 UTC | |
by rvlahov (Novice) on Dec 26, 2002 at 21:04 UTC | |
|
Re: TCP to Serial and back
by tachyon (Chancellor) on Dec 27, 2002 at 10:10 UTC |