howto socket server

We’ve got this program that we want to interface to via sockets. So I
set up a socket, bind to an address, listen for N, and begin accepting
connections. Most of it’s working fine. The one problem (I think) is in
the binding. This machine is kind of a second class citizen on a MS
based network. What that means is that it uses DHCP to determine its IP
address at startup time. But it doesn’t really show up in the MS
specific name resolver, nor does it seem like it can. And that’s OK.
This is just for development purposes that it sits on that network right
now. Upon deployment, it won’t be on that network anymore. Typically,
we’ve been using telnet to interface with the program for now (though
we’ve also written some of our own interface stuff as well). If I create
the address from “127.0.0.1”, then I can run the program on the machine,
and in another shell window type ‘telnet localhost’. This connects and
away I’m going. Kind of. At this point, I can’t telnet in from another
machine (e.g. telnet 172.16.20.59 fails, that address is the address
that an ifconfig en0 at the server machine shows). If I change the code
to bind to that specific address (the DHCP addresses usually last a
couple of weeks it seems), then I can connect from other machines, but
the telnet localhost no longer works. How do I get around this? I want
to be able to connect locally. I want to be able to connect from other
machines. I don’t want to have to hardcode 172.16.20.59 (or whatever)
into my code.

Any help greatly appreciated; TIA

Travis Griggs (a.k.a. Lord of the Fries)
Member: 3rd Boolean State Software Collective
Key Technology
“It had better be a pretty good meeting to be better than no meeting at
all”-- Boyd K. Packer

bind to ip address 0.0.0.0

-xtang

Travis Griggs <tgriggs@keyww.com> wrote:

We’ve got this program that we want to interface to via sockets. So I
set up a socket, bind to an address, listen for N, and begin accepting
connections. Most of it’s working fine. The one problem (I think) is in
the binding. This machine is kind of a second class citizen on a MS
based network. What that means is that it uses DHCP to determine its IP
address at startup time. But it doesn’t really show up in the MS
specific name resolver, nor does it seem like it can. And that’s OK.
This is just for development purposes that it sits on that network right
now. Upon deployment, it won’t be on that network anymore. Typically,
we’ve been using telnet to interface with the program for now (though
we’ve also written some of our own interface stuff as well). If I create
the address from “127.0.0.1”, then I can run the program on the machine,
and in another shell window type ‘telnet localhost’. This connects and
away I’m going. Kind of. At this point, I can’t telnet in from another
machine (e.g. telnet 172.16.20.59 fails, that address is the address
that an ifconfig en0 at the server machine shows). If I change the code
to bind to that specific address (the DHCP addresses usually last a
couple of weeks it seems), then I can connect from other machines, but
the telnet localhost no longer works. How do I get around this? I want
to be able to connect locally. I want to be able to connect from other
machines. I don’t want to have to hardcode 172.16.20.59 (or whatever)
into my code.

Any help greatly appreciated; TIA

Travis Griggs (a.k.a. Lord of the Fries)
Member: 3rd Boolean State Software Collective
Key Technology
“It had better be a pretty good meeting to be better than no meeting at
all”-- Boyd K. Packer