• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
UDP broadcast address issues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

UDP broadcast address issues


  • Subject: UDP broadcast address issues
  • From: Mark Hunt <email@hidden>
  • Date: Mon, 5 Apr 2004 16:03:23 +0100

Hi

I'm having some problems with UDP broadcasting (again).

If I send datagrams from my AirPort connected PowerBook (10.2.6), the
broadcasts get sent to the subnet address: 192.168.0.255.

If I run the same program on my wire-connected desktop (10.3.3), they
go to 255.255.255.255.

The router is a NetGear MR-314.

Neither the desktop nor the PowerBook receive the 192.168.0.255
datagrams, but they both receive the 255.255.255.255 ones.

tcpdump shows the network traffic going through the router - both
machines seem to be ignoring the subnet-directed broadcasts.

If I switch locations on the PowerBook, it starts sending to
255.255.255.255, and everything starts working. I don't really want to
tell my users to do this ;-)

Anyone know what I'm doing wrong (code snippet follows)?

Thanks for any help

Mark

int gfd_enet = -1; // ethernet socket, if opened
struct sockaddr_in dst_addr = {sizeof(struct sockaddr_in), AF_INET,
0x880e, {-1}};

void OpenUDP(void)
{
int osstatus = noErr;
struct sockaddr_in addr;
int on = 1;

bzero(&addr, sizeof(addr));
addr.sin_len = sizeof(addr);
addr.sin_family = AF_INET;
addr.sin_port = 0x880e;

gfd_enet = socket(AF_INET, SOCK_DGRAM, 0);

if(gfd_enet != -1)
{
printf(" UDP socket opened OK\n");

osstatus = bind(gfd_enet, (struct sockaddr*)&addr, sizeof(addr));
if(osstatus != 0) printf(" bind returned %d\n", osstatus);

osstatus = setsockopt(gfd_enet, SOL_SOCKET, SO_BROADCAST, &on,
sizeof(on));
if(osstatus != 0)
{
printf(" setsockopt(SO_BROADCAST) returned %d\n", osstatus);
printf(" errno = %d\n", errno);
}

}
else
printf(" Error opening UDP socket! (%d)\n", errno);

}


=================
Mark Hunt
LSD FourthPhase
Birmingham
England
email@hidden
=================


This message was checked by Mcafee Virusscan Enterprise
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.


  • Prev by Date: Re: Carbon alternative to NSHTCPWillDial?
  • Next by Date: UDP broadcast address issues
  • Previous by thread: RE: Not able to accept more than 60 connections
  • Next by thread: UDP broadcast address issues
  • Index(es):
    • Date
    • Thread