473,322 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

bind to a specific IP address

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??
Nov 13 '05 #1
5 9385
Roger Jansen <xx*@fel.tno.nl> scribbled the following:
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 (pa*****@cc.helsinki.fi) ---------------------------\
| 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
Nov 13 '05 #2


Joona I Palaste wrote:

Roger Jansen <xx*@fel.tno.nl> scribbled the following:
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.

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?
Nov 13 '05 #3
Roger Jansen <xx*@fel.tno.nl> writes:
Joona I Palaste wrote:

Roger Jansen <xx*@fel.tno.nl> scribbled the following:
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.

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
Nov 13 '05 #4
Roger Jansen <xx*@fel.tno.nl> wrote:
Joona I Palaste wrote:

Roger Jansen <xx*@fel.tno.nl> scribbled the following:
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.

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
Nov 13 '05 #5
bd
Roger Jansen wrote:


Joona I Palaste wrote:

Roger Jansen <xx*@fel.tno.nl> scribbled the following:
> 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.

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.
--
I have learned silence from the talkative,
toleration from the intolerant, and kindness from the unkind.
-- Kahlil Gibran

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Clarence Gardner | last post by:
I've got a problem that I don't see how to program around. A socket server that was running fine, today started getting an exception from the bind() call (errno 22, Invalid argument) and yet the...
1
by: Roger Jansen | last post by:
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...
4
by: 0k | last post by:
Hi everyone, I am trying to write a small app that sends multicast udp packets using a socket object. I have more than one NIC on my PC and the following code works OK only if I disable all the...
1
by: meulie | last post by:
Hi all! Is it possible to bind MySQL 4.1 to more than 1 interface? Will multiple 'bind-address=x.x.x.x' statements do the job? Regards, Evert
7
by: USUN_TO | last post by:
Hi, i got problem when i bind in this way: local_addr.sin_family = AF_INET; local_addr.sin_addr.s_addr = inet_addr("127.0.0.1"); local_addr.sin_port = htons(CLIENT_PORT); i can easly bind...
4
by: Pieter | last post by:
Hi, I want to bind a proeprty of a child object to a DataGridView, but it doesn't work. For instance: Imagen that I have an object Company, and this object company has a child object...
5
by: natambu | last post by:
I have a linux box with multiple ip addresses. I want to make my python client connect from one of the ip addresses. Here is my code, no matter what valid information I put in the bind it always...
1
by: MaheBytes | last post by:
I have been facing a problem with UDP socket programming. I have to reuse port number for two different IP address. I am actually using SO_REUSEADD. I have no problem with debug version but with...
10
by: Jan Vinten | last post by:
Hi all, I got into some trouble trying to bind to a specific IP address. Code: Private mobjClient As TcpClient mobjClient = New TcpClient(IPAddress.Parse("10.16.104.87").ToString, 8892)
3
by: Giovanni Gherdovich | last post by:
Hello, in the following code I have a pointer (to function), say p, of type double (*)(double, double, void*) and I try to fix the second argument of the function *p to a given value (using...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.