[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Making a TCP or UDP or Unux Socket Server Listen on a port



>From "man services":

       services is a plain ASCII file providing a mapping between
       friendly textual names for internet  services,  and  their
       underlying assigned port numbers and protocol types.

So... that file is just a way to translate between port names and
numbers, not a magic way to "make" a program listen on that port. You
are correct in that your entry would associate "a.out" with port 9889,
in that once you get the program running, a "netstat" would show "a.out"
listening on port "a.out" instead of port 9889.

When you run your server program, try running a netstat. Do you see
something on port 9889? If so, look at how the client is contacting it.
If not, your server program isn't binding to a socket. see man 2 socket,
man 7 socket, and a bunch of other man pages for further information.

--Rich


shyamk@eth.net wrote:
> 
> I am having  Server Programs (for TCP,UDP,Unix Sockets) , that listen on a port
> number say , 9888 at
> 10.10.1.4
> and they are being contacted by a Client (for TCP,UDP,Unix Sockets)  Linux machine
> from 10.10.1.1 .
> 
> Both macines are on the LAN , nothing more nothing less . We have not yet gone for
> any higher stuff like DNS , etc . So , basically  10.10.1.4
> and 10.10.1.1 are not on any Linux network , but simply they identify and respond on
> the LAN.
> 
> My Clients and Server (socket  programs) do not communicate at all on this network .
> 
> Please guide me on what I should do .
> 
> My line of thinking is : Add some  entry to the
> /etc/services   specifying the port , but this is what I tried and failed :-
> # At the bottom of /etc/services  :-
> tcp 9888/tcp
> a.out 9889/tcp
> 
> Please help me get these programs to communicate .
> 
> Warm regards,
> (shyamk@eth.net)
> Shyam
> 

_________________________________________________________
                         
Rich Puhek               
ETN Systems Inc.         
_________________________________________________________



Reply to: