hello everyone.....
when i went to hostel my parents used to call me every other minute espl my sister....
once my father told me that the phone bill has increased at least five fold
so i decided to make a chatting software so that we can talk anytime.......
here it goes
the host
use IO::Socket; #use the socket module use strict; #am bit careless so i need this my $socket=new IO::Socket::INET( LocalAddr=>'<my IP>' , LocalPort=>8080, Listen=>1, ) or die "cannot create host\n"; my ($client,$scrap_out,$scrap_in); while($client=$socket->accept()) { while(1) { #now recieve the messeage $scrap_in=<$client>; print "scrap_in:\t$scrap_in\n"; print "scrap_out:\t"; $scrap_out=<>; print $client $scrap_out; if($scrap_out=~/'bye'/i or $scrap_in=~/'bye'/) {close $socket and die "connection closed\n";} } }
the client
use IO::Socket; use strict; print "enter host name to connect to:\t"; my $hostname=<>; my $socket= new IO::Socket::INET( PeerAddr=>$hostname, PeerPort=>8080, Reuse=>1, ) or die "cannot connect to host at this time\n"; my($scrap_in,$scrap_out); while(1) { print "scrap_out:\t"; $scrap_out=<>; print $socket $scrap_out; $scrap_in=<$socket>; print "scrap_in:\t$scrap_in\n"; if($scrap_in=~/'bye'/i or $scrap_out=~/'bye'/i) {close $socket and die "connection ended\n";} }

so this way we chat everyday in the evening and even my dad installed perl and this program in many of his friend's and relative's lappys and he told me that the phone bill is reduced five folds!!!!
coooolll
ps:- the <my ip> string is the ip given to me by my college server and i know this is bit clumsy but this dates back to when i first started network programming in perl

In reply to a host/client chat program by hnd

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.