John Serink wrote: > Hi All: > > lets talk about some of the most poorly documented stuff with respect to > Perl's socket functionality, be it the IO::Socket or just plain socket. > > Check this snippet out:
<snip> > I get this when I run this: > F:\perl\practice\VRS>perl nagel5.pl > tcpnodelay with getsockopt is 0 > tcpnodelay is 0 > Successfully changed Nagel > tcpnodelay with getsockopt is 1 > tcpnodelay is 0 > > So, when I change the TCP_NODELAY flag using the Perl function > setsockopt, it reports its changed using getsockopt but not using the OO > interface. > > Where's the beef? > Did it change or not? Shouldn't both queries of TCP_NODELAY return the > same or is something being chached somewhere? If I change with the OO > method, only the OO method query says its changed, if I change with the > perlfunc then only the perlfunc query says it has been changed, the OO > says its still zero. > > Any ideas? Don't mix the calls maybe ? I don't know if there is any advertised compatability between the two. They should work fine if you just use one or the other - try this : use strict; use warnings; use Socket qw(:all); use IO::Socket; use IO::Socket::INET; my $sock; my $tcpnodelay; print "\nUsing built-in method\n"; my $proto = getprotobyname ('tcp'); socket ($sock, PF_INET, SOCK_STREAM, $proto) or die "Socket: $! ($^E)"; $tcpnodelay = getsockopt ($sock, IPPROTO_TCP, TCP_NODELAY); $tcpnodelay = unpack 'I', $tcpnodelay; print "Before: tcpnodelay=$tcpnodelay\n"; setsockopt $sock, IPPROTO_TCP, TCP_NODELAY, 1 or die "setsockopt: $! ($^E)"; $tcpnodelay = getsockopt ($sock, IPPROTO_TCP, TCP_NODELAY); $tcpnodelay = unpack 'I', $tcpnodelay; print "After: tcpnodelay=$tcpnodelay\n"; print "\nUsing OO method\n"; $sock = IO::Socket::INET->new(Type => SOCK_STREAM, Proto =>'tcp') or die "new IO::Socket::INET: $! ($^E)"; $tcpnodelay = $sock->sockopt(TCP_NODELAY); print "Before: tcpnodelay=$tcpnodelay\n"; $sock->sockopt(TCP_NODELAY, 1) or die "\$sock->sockopt NODELAY, 1: $! ($^E)"; $tcpnodelay = $sock->sockopt(TCP_NODELAY); print "After: tcpnodelay=$tcpnodelay\n"; print "\n"; __END__ -- ,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED] (_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED] / ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/ -/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff) _______________________________________________ Perl-Win32-Admin mailing list Perl-Win32-Admin@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs