bind to a specific IP address

R

Roger Jansen

I want to create a UDP socket that receives broadcast messages only from
a specific network device (in case there are more than one network
devices).

When I bind the socket to INADDR_ANY I receive all messages, but when I
bind to a specific IP address, no broadcast messages are received at all
on IRIX or Linux. On Windows2K it works like I expected.

I still have to test it on a Unix machine with two network cards, but I
think binding to a specific address should work also with only one.

Note that when I use INADDR_ANY on Windows with two network cards each
connected to a seperate network, I receive each message twice on the
same socket!! That's why INADDR_ANY in combination with different UDP
ports for both netwoks is not an option.

Does anyone has experience with multiple network devices??
 
J

Joona I Palaste

Roger Jansen said:
I want to create a UDP socket that receives broadcast messages only from
a specific network device (in case there are more than one network
devices).

Stop right there. ISO standard C specifies no networking facilities
whatsoever. At least these terms in your message are not specified by
the C standard: "UDP", "socket", "receive", "broadcast", "message",
"network" and "device".
Please ask in a newsgroup dedicated to your own platform.

--
/-- Joona Palaste ([email protected]) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"How come even in my fantasies everyone is a jerk?"
- Daria Morgendorfer
 
R

Roger Jansen

Joona said:
Stop right there. ISO standard C specifies no networking facilities
whatsoever. At least these terms in your message are not specified by
the C standard: "UDP", "socket", "receive", "broadcast", "message",
"network" and "device".
Please ask in a newsgroup dedicated to your own platform.
I thought this was a C newsgroup and bind() is C function on every
platform I know. Maybe rename this group to comp.lang.iso-standard-c
where people can only ask general questions who don't have an
iso-standard-C manual?
 
R

Richard Bos

Roger Jansen said:
I thought this was a C newsgroup

Yes, but...
and bind() is C function on every platform I know.

....you can't know very many platforms, then. Ever programmed an elevator
controller? A Sinclair QL? Hell, ever even seen a DOS prompt?
Maybe rename this group to comp.lang.iso-standard-c

That's an old joke. In any case, there are more than enough newsgroups
for specific platforms.

Richard
 
M

Martin Dickopp

Roger Jansen said:
I thought this was a C newsgroup

It is.
and bind() is C function on every platform I know.

This may well be the case, but that only means you don't know many
platforms. :)

Just to name a few, neither my washing machine, nor my microwave oven, nor
my CD player, nor my radio receiver has or needs a `bind' function.
Maybe rename this group to comp.lang.iso-standard-c where people can
only ask general questions who don't have an iso-standard-C manual?

It is not true that only general questions are on-topic here. Specific
questions about the C language are very welcome.

Martin
 
B

bd

Roger said:
I thought this was a C newsgroup and bind() is C function on every
platform I know. Maybe rename this group to comp.lang.iso-standard-c
where people can only ask general questions who don't have an
iso-standard-C manual?

It's not in DOS. That's a C platform, last I heard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top