Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!think.com!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.jpl.nasa.gov (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: using sendto and recvfrom in perl Message-ID: <1991Jun17.165109.7677@jpl-devvax.jpl.nasa.gov> Date: 17 Jun 91 16:51:09 GMT References: <1934@uqcspe.cs.uq.oz.au> <1991Jun16.045207.6561@convex.com> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 33 In article weg@convx1.ccit.arizona.edu (Eythan Weg) writes: : In article <1991Jun16.045207.6561@convex.com> tchrist@convex.COM (Tom Christiansen) writes: : : From the keyboard of tonyg@cs.uq.oz.au: : :I want to use the system calls "recvfrom" and "sendto" in a perl script. : :Has anyone put some nice wrappers around these system calls? : : : :My current version appears to be a *bit* buggy. : : : :This is under SunOS 4.1 and using perl version 4.0 patchlevel 10 : : : :here's my code - ignore the fact that I'm not returning any data as yet... : : Use send for sendto: just add another parameter. Your syscall for recvfrom : looks a little questionable on the $from -- seems like an odd way to make : a sockaddr. I haven't looked too hard though. : : I have actually tried to use send and recv between datagram sockets. : It worked beautifully. Trying to do the same with connected stream-sockets : failed with recv error. Is perl expected to recv? Perl always does a recvfrom() when you say recv(). (Look at eval.c if you don't believe me.) If your implementation of sockets can't do recvfrom() on a stream socket, it's busted. It would certainly be possible to work around such bogosity, but I usually rely on othere's to send me the patches... But anyway, there's no need to use syscall to get at sendto() or recvfrom(). (Note that Perl's recv() was partially busted in the late 3.0 era, so be sure to use a recent version.) Larry