A socket by any other name...

Don E. Davis ded at aplvax.UUCP
Thu Oct 24 11:53:08 AEST 1985


How in the world do I name a socket?  Bind's just not working for me.

Let me back up and start at the beginning.  I wanted to allow one
process to communicate with serveral others.  I could have done
this with pipes, but this seemed like a perfect opportunity to
get acquainted with sockets.

The SOCK_DGRAM type seemed suitable for the job.  All I had to do
was create two unconnected sockets of that type and wail away.  Or so I
thought.  I stuck with AF_INET domain sockets to avoid any bug problems.
And indeed, creating a SOCK_DGRAM socket was easy.  And the "sendto" and 
"recvfrom" functions seem straightforward enough if only I can figure out
who the "to" is.  I tried to bind the sockets with the internet address
of my machine and a port number, but if I use any other port number than
zero, the bind is rejected on access grounds.  I am not attempting
to use any port number already allocated in /etc/services.  Surely, one does not
need a setuid-to-root program merely to create and use sockets?
What am I doing wrong?

Does anyone have some code examples implementing socket connections they
could send me?  The documentation isn't too helpful.  Thanks.




-- 

					Don Davis
					JHU/APL
				...decvax!harpo!seismo!umcp-cs!aplvax!ded
				...rlgvax!cvl!umcp-cs!aplvax!ded



More information about the Comp.unix.wizards mailing list