Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nntp.coast.net!zombie.ncsc.mil!newsgate.duke.edu!news.mathworks.com!tank.news.pipex.net!pipex!dispatch.news.demon.net!demon!awfulhak.demon.co.uk!awfulhak.demon.co.uk!awfulhak.demon.co.uk!not-for-mail From: brian@awfulhak.demon.co.uk (Brian Somers) Newsgroups: comp.unix.bsd.freebsd.misc Subject: Re: FreeBSD 2.1.0 broadcast problem/bug : does it ring a bell ? Date: 19 Jun 1996 05:28:32 +0100 Organization: Coverform Ltd. Lines: 24 Message-ID: <4q7vlg$9o@anorak.coverform.lan> References: <4pk4vh$1db@cyan.wanadoo.fr> X-NNTP-Posting-Host: awfulhak.demon.co.uk X-Newsreader: TIN [version 1.2 PL2] Pierre-Yves Kerembellec (pyk@sv.vtcom.fr) wrote: [....] : memset(&tSocket,0,sizeof(tSocket)); : tSocket.sin_port = htons(9090); : tSocket.sin_family = AF_INET; : tSocket.sin_addr.s_addr = INADDR_BROADCAST; : strcpy(sBuffer,"Hello world"); : if (sendto(fSocket,sBuffer,strlen(sBuffer),0,(struct sockaddr *)&tSocket,sizeof(tSocket)))<0) : {perror("sendto"); exit(3);} [....] Don't you need: tSocket.sin_port = 9090; tSocket.sin_len = sizeof( tSocket ); You don't need sin_port in network byte order as it's an internal structure. The underlying code in sendto will get this field and fill the packet with the htons() version. I suspect the sin_len bit (or lack of it) may be causing problems. -- Brian <brian@awfulhak.demon.co.uk> Don't _EVER_ lose your sense of humour....