473,670 Members | 2,648 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 9409
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.hel sinki.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
10148
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 bind had actually worked. This is apparent from this code: it prints the error message, but then breaks out of the loop and the listen() and accept() calls work normally. How can one handle a function that is both working and raising an...
1
1552
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 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...
4
2752
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 NICs but the one i want to use. Of course i tried to use Socket.Bind method, but even if i use it to bind to the correct NIC (I also verify using LocalEndPoint and IT IS the correct one), the packet is sent on the wrong NIC! (I have a software...
1
20717
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
8970
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 port without any SIGSEGV (segmentation fault) but MSDN wrote:
4
1622
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 Address. Address has a property Street.
5
6870
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 comes from the default ip address on the server. Am I doing something wrong? ------------- #!/usr/bin/python import socket
1
2479
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 release version the bind is failing for 2nd IP address with the error code 10048. It's the error code for WSAEADDRINUSE. I am trying to with WinXP machine using Visual C++ 6.0. The application which we are using needs to connect to Primary and Backup...
10
6237
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
3332
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 boost::bind), but the compiler complains, because of a type mismatch in an assignment which I think should be legal:
0
8386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8903
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8815
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8661
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6216
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4213
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4393
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2044
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1795
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.