sub new { my ($class,$device,$serveraddr,$port) = @_; my $self = {}; bless ($self,$class); $self = { 'device' => $device, 'serveraddr' => $serveraddr, 'port' => $port }; #### my $SockObj = Communication->new( $self->{$serveraddr}, $self->{$port}); #### sub Communication::new { my $class = shift; my ($addr, $port) = @_; my $socket = IO::Socket::INET->new( Proto => "tcp", PeerAddr => $addr, PeerPort => $port, ) or die "couldn't connect: $!"; $socket->autoflush(); return bless $socket, $class; }