1

I have an app running as a daemon on a linux box (Red Hat). The purpose of the app is to act as a registrar of sorts -- another device can connect to this host machine, and register (this is me, I am here -- this kind of thing). There is more than one IP address for this machine.

How do I connect/send/forward incoming connections (i.e., the registration data) to my daemon? That is, when the device wants to register and connects to my IP address, how do I direct the traffic to my process/daemon?

Thank you very much for all your help!

:bp:

Billy Pilgrim
  • 1,842
  • 3
  • 22
  • 32
  • This is rather vague, not much information. What language is the daemon written in, have you implemented any network abilities at all so far? – tink Mar 06 '13 at 22:33
  • If your listen socket is bound to all addresses this isn't a problem. Any IP your server has will connect to your service. If you need to listen on specific IP addresses then you need to have a configuration file or use OS-specific methods to enumerate all of the available addresses and choose to bind a listen socket to each one. – Zan Lynx Mar 06 '13 at 23:28

1 Answers1

0

Hi you may need to give a little more info.

What it sounds like you want to do is listen on a tcp port with your daemon. There are different ways to do this in different languages.

Another thing to watch out for are the reserved port ranges. Some ports can only be used by users with elevated privileges. See here http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers TCP and UDP port ranges, They dynamic range is free to use as long as there is nothing else on that port.

What language are you using? In Perl This, is how you listen. And I could list off other tutorials for other languages, but there is not much point.

In reponse to the comment, I think this stackoverflow question answers the question.

Community
  • 1
  • 1
Dan Walmsley
  • 2,765
  • 7
  • 26
  • 45
  • Sorry it was vague, I didn't want to pollute with too much irrelevant info. Tis written in C/C++, and I believe there will be another service running on the same box, but with a different IP address. I suppose that shouldn't matter if I can focus the listen to a specific IP address. The socket API does not, I believe, let me specify which IP address to which I want to listen, just the port. – Billy Pilgrim Mar 06 '13 at 23:46