Particulrly could you pealse tell me the corresponding functions for "inet_aton", how to open a raw socket in v6,send raw data and in which format we have to provide IPv6 format (2222:10::3). I went through http://search.cpan.org/~umemoto/Socket6-0.19/Socket6.pm README, but it's not giving clear information. Aprrecitae your help!!sub sendraw { my ($pstr)=@_; $PROTO=getprotobyname('tcp')||0; @DXX=(); $pstr=~s/\n/\r\n/g; $pstr=~s/\r\r/\r/g; debugprint("Sending raw: $pstr"); if($D{'XXinet_aton'} eq ''){ if(!($D{'XXinet_aton'}=inet_pton(FAMILY,$D{'XXTarget'}))){ wprint("! DNS lookup failure."); $D{'XXDead'}=1; return;}} if($^O=~/win/i){ sendraw_win($pstr);} else { sendraw_unix($pstr);} } sub sendraw_unix { my ($pstr)=@_; $D{'XXHaveHeaders'}=0; eval { alarm($D{'XXTimeoutVal'}); $D{'XXDead'}=1; if(!(socket(S,PF_INET,SOCK_STREAM,$PROTO))){ wprint("= Socket problems"); return;} if($D{'XXSessSplice'}>0){ # session splicing setsockopt(S,SOL_SOCKET,SO_SNDLOWAT,1); @chars=split(//,$pstr);} if(connect(S,sockaddr_in($D{'XXPort'},$D{'XXinet_aton'}))){ select(S); $|=1; if($D{'XXSessSplice'}>0){foreach $char (@chars){print $char; select(undef,undef,undef,$D{'XXIDSMode9Wait'});} }else{print $pstr;} while(<S>){ $line=$_; push(@DXX,$line); if ($line=~/^[\r\n]+$/){ # we can continue $D{'XXHaveHeaders'}=1; $D{'XXDead'}=0; +} last if ($line=~/^[\r\n]+$/ && $D{'XXNoContent +'} > 0);} select(STDOUT); close(S); alarm(0); $D{'XXDead'}=0; return; } else { wprint("= Not responding...");} alarm(0);}; if ($@) { if ($@ =~ /timeout/){wprint("= Timed out\\"); $D{'XXDead'}==1?wprint(". Aborting."):wprint(", but continuing +.");}}}
In reply to please provide solution to convert the follwoing IPv4 Socket functions to Ipv6 using Socket6 by phemal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |