FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Embedded

 
 
LinkBack Thread Tools
 
Old 01-17-2008, 08:44 PM
Jean-Claude Gervais
 
Default sys/socket.h - no close() ?

Hello,

I've programmed client-server type applications using sockets before,
but on Windows.

I understand that to allocate a socket, I must call 'socket'

What I do not understand is how to discard the socket: is there a
diffierent way on *nix (or embedded)?

Usually, I would call 'closesocket' (on Windows) or 'close' on *nix but
the sys/socket.h file doesn't define a close function, so which close do
I call?

J

--
gentoo-embedded@lists.gentoo.org mailing list
 
Old 01-17-2008, 08:51 PM
Mathieu Dube
 
Default sys/socket.h - no close() ?

On Thu, Jan 17, 2008 at 04:44:43PM -0500, Jean-Claude Gervais wrote:
> Usually, I would call 'closesocket' (on Windows) or 'close' on *nix but
> the sys/socket.h file doesn't define a close function, so which close do
> I call?

you can call close included unistd.h on the fd(socket)

or shutdown from sys/socket.h

-M
--
Give a man a fire and he'll be warm for a day. But light a man on fire and
he'll be warm for the rest of his life.
--
gentoo-embedded@lists.gentoo.org mailing list
 
Old 01-18-2008, 07:54 AM
Bob Dunlop
 
Default sys/socket.h - no close() ?

On Thu, Jan 17 at 04:51, Mathieu Dube wrote:
> On Thu, Jan 17, 2008 at 04:44:43PM -0500, Jean-Claude Gervais wrote:
> > Usually, I would call 'closesocket' (on Windows) or 'close' on *nix but
> > the sys/socket.h file doesn't define a close function, so which close do
> > I call?
>
> you can call close included unistd.h on the fd(socket)
>
> or shutdown from sys/socket.h

Uhm. shutdown() does not release the file/socket descriptor and you
still need to call close(). Simpler just to call close() in the
first place.


--
Bob Dunlop
--
gentoo-embedded@lists.gentoo.org mailing list
 

Thread Tools




All times are GMT. The time now is 09:27 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org