The following examples demonstrates how sockets are used with the IO::Socket::INET and IO::Select modules to communicate with the T95 temperatur controller:
#!/usr/bin/env perl # use strict; use IO::Socket::INET; use IO::Select; my $sock = IO::Socket::INET->new(PeerAddr => "hastsXX.desy.de", PeerPort => 4504, Proto => 'tcp', Type => SOCK_STREAM) || die "Failed to connect\n"; $sock->send( "T\015"); my $s = new IO::Select(); $s->add( $sock); my $buffer = ""; while( length( $buffer) == 0 || $s->can_read(0.1)) { $sock->recv( $buffer, 100); } my @list = unpack( "C*", $buffer); print " received @list\n"; close($sock);