previous | start

Sockets in Other Languages

The Perl programming language has become very popular in recent years. It's interesting to compare a Perl client program with the Java program from earlier:
#!/usr/local/bin/perl
use IO::Socket::INET;

$sock = IO::Socket::INET->new(PeerAddr => 'ironbark',
                              PeerPort => 'finger(79)',
                              Proto    => 'tcp');
print $sock "pscott\n";

while(<$sock>) {
    print;
}
On the other hand, a C program to perform the same function is about 100 lines, not including comments...
 
The tutorial for this lecture is Tutorial #09.
La Trobe Uni Logo [Previous Lecture] [Lecture Index] [Next Lecture]
Copyright © 2001 by Philip Scott, La Trobe University.
Valid HTML 3.2!

previous | start