home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.ultrix
- Path: sparky!uunet!mcsun!sun4nl!eur.nl!pk
- From: pk@cs.few.eur.nl (Paul Kranenburg)
- Subject: Re: A major BSD socket bug?
- Message-ID: <1992Sep9.113405.22727@cs.few.eur.nl>
- Sender: news@cs.few.eur.nl
- Reply-To: pk@cs.eur.nl
- Organization: Erasmus University Rotterdam
- References: <1992Sep9.053147.411@lmpsbbs.comm.mot.com>
- Date: Wed, 9 Sep 1992 11:34:05 GMT
- Lines: 17
-
- In <1992Sep9.053147.411@lmpsbbs.comm.mot.com> rittle@supra (Loren James Rittle) writes:
-
- >I have reproduced this bug (be it in my code or the BSD OS) under
- >both ULTRIX 4.2A and SunOS 4.1.2. As I don't read any sun groups, I didn't
- >know where to crosspost there. The example below is under 20 lines of code.
- >If you are a BSD hacker, please take a look.
-
- You just need to re-initialize `rcvsize' each time you call recv_from.
- Like so:
-
- >#define ERROR(a) do { perror (a); exit (1); } while (0)
- >#define SEND(m) if (sendto (s,m,sizeof m,0,&a,sizeof a)==-1) ERROR ("sendto");
- >#define RECV rcv.sin_addr.S_un.S_addr = 0; m[0] = '\0'; \
- rcvsize = sizeof rcv; \
- > recvfrom (s, m, sizeof m, 0, &rcv, &rcvsize); \
- > printf ("%d %s\n", rcv.sin_addr.S_un.S_addr, m)
-
-