Changeset 8466
- Timestamp:
- 03/28/08 16:15:24 (5 years ago)
- Location:
- lang/perl/Net-Partty/trunk
- Files:
-
- 2 modified
-
example/pertty.pl (modified) (3 diffs)
-
lib/Net/Partty.pm (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Net-Partty/trunk/example/pertty.pl
r8453 r8466 113 113 STDOUT->syswrite($buf, $len); 114 114 unless ($opts->{noconnect}) { 115 $partty->sock->s yswrite($buf, $len);115 $partty->sock->send($buf); 116 116 $partty->can_write(100); 117 117 } … … 121 121 $master->syswrite($buf, $len); 122 122 } elsif ($fno == $p_fno) { 123 my $len = $fh-> sysread(my $buf, 4096);123 my $len = $fh->recv(my $buf, 4096); 124 124 $master->syswrite($buf, $len) unless $opts->{kill_guest}; 125 125 } … … 140 140 141 141 return if $opts->{noconnect}; 142 my $cmd = pack 'CCCnnCC', 255, 250, 31, $size[0], $size[1], 255, 240; 143 $partty->sock->syswrite($cmd, 9); 144 $partty->can_write(100); 142 $partty->sock->sb(chr(31), pack('nn', $size[0], $size[1])); 145 143 } 146 144 -
lang/perl/Net-Partty/trunk/lib/Net/Partty.pm
r8454 r8466 9 9 use Carp; 10 10 use IO::Select; 11 use IO::Socket ;11 use IO::Socket::Telnet; 12 12 13 13 my $DefaultOpts = { … … 33 33 sub _sock_open { 34 34 my $self = shift; 35 $self->{sock} = IO::Socket:: INET->new(35 $self->{sock} = IO::Socket::Telnet->new( 36 36 PeerAddr => $self->host, 37 37 PeerPort => $self->port, 38 Blocking => 1,39 38 Proto => 'tcp', 40 39 ) or croak $!; … … 54 53 my($self, $int) = @_; 55 54 my $data = pack 'C', $int; 56 $self->sock->s yswrite($data, 1);55 $self->sock->send($data); 57 56 } 58 57 sub _send_uint16 { 59 58 my($self, $int) = @_; 60 59 my $data = pack 'n', $int; 61 $self->sock->s yswrite($data, 2);60 $self->sock->send($data); 62 61 } 63 62 … … 73 72 74 73 croak 'session time out' unless $self->can_write(10); 75 $self->sock->s yswrite('Partty!', 7);74 $self->sock->send('Partty!'); 76 75 $self->_send_uint8(2); 77 76 for my $param (@params) { … … 79 78 } 80 79 for my $param (@params) { 81 $self->sock->s yswrite($opts{$param}, length$opts{$param});80 $self->sock->send($opts{$param}); 82 81 } 83 $self->sock->flush;84 82 85 83 … … 105 103 } 106 104 105 { 106 package # 107 IO::Socket::Telnet; 108 sub sb { 109 my($self, $cmd, $opt) = @_; 110 $self->send(chr(255) . chr(250) . $cmd . $opt . chr(255) . chr(240)); 111 } 112 } 107 113 108 114 1;
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)