[ee122] Son of a Beej

Vern Paxson vern at icir.org
Fri Sep 21 10:38:32 PDT 2007


> I was looking at Beej's code for a multi-user setup and I noticed that he
> was passing the pointer to the same sockaddr_in space for each new
> connection. accept() says that this is thusly filled in with the client's
> info.

Per Daniel's reply, yeah, the client info is overwritten.

> But isn't that space already filled in with someone else's info? we're
> passing the address of the physical memory to be filled in.
> 
> Can someone clarify where I went wrong with this one?

The key is that the sockaddr_in is just a user-level copy of some info
that the kernel is keeping.  So unless your application needs to keep
track of the address information (usually it won't), there's no harm in
overwriting it.

		Vern


More information about the ee122 mailing list