Thread View: comp.unix.programmer
2 messages
2 total messages
Started by csteow
Thu, 04 Oct 2001 03:53
Coding for Multiple IP addresses
Author: csteow
Date: Thu, 04 Oct 2001 03:53
Date: Thu, 04 Oct 2001 03:53
14 lines
1412 bytes
1412 bytes
Hi: I plan to have a machine with 3 IP addresses and I run my app to listen to port 9000. How to do socket programming on handling multiple IP to listen to same port? Is it using "bind()" and use "select()" to pass in the three socket handle? I can't try on my own since I don't own multiple IP machine, could anybody tell me that what I mention on above correct? Thanks. Regards, Chin Siang
Re: Coding for Multiple IP addresses
Author: Chris Liechti
Date: Thu, 04 Oct 2001 20:12
Date: Thu, 04 Oct 2001 20:12
38 lines
2095 bytes
2095 bytes
"csteow" <chinsiang@csksoftware.com.sg> wrote in news:9pgjkm$3rv$1@newton3.pacific.net.sg: > Hi: > > I plan to have a machine with 3 IP addresses and I run my app to listen > to port 9000. How to do socket programming on handling multiple IP to > listen to same port? Is it using "bind()" and use "select()" to pass in > the three socket handle? I don't know the C semantics but ususaly you use "bind" to install your server socket and as argument you can give an IP address, which will mean that you bind *only* to that address. If you want to bind to *all* network interfaces you use "INADDR_ANY" (0.0.0.0). if you have linux try "man 7 ip", "man 2 bind", "man socket" > I can't try on my own since I don't own multiple IP machine, could > anybody tell me that what I mention on above correct? Yes you do, if you have one ethernet card or dialup. The other address is 127.0.0.1 and is called "localhost". Its the local loopback device which lets you test any network software on the local machine. > Thanks. > > Regards, > Chin Siang > > > -- Chris <cliechti@gmx.net>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads