PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Noms de domaine > comp.protocols.tcp-ip > Between listen and accept
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.protocols.tcp-ip TCP and IP network protocols.

Between listen and accept

Réponse
 
LinkBack Outils de la discussion
Vieux 21/11/2006, 14h34   #1
awahl@yahoo.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Between listen and accept

Hello,

In a socket based program,is it possible to know, when returning from
listening to whom we will be connected before issueing the accept

s= socket(xxx)
bind(xxx)
listen(xxxx)

Can we know here to whom we will be connected (ip address of peer)

accept(xxx)


Thank you

Aron

  Réponse avec citation
Vieux 21/11/2006, 16h33   #2
James Carlson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Between listen and accept

awahl@yahoo.com writes:
> In a socket based program,is it possible to know, when returning from
> listening to whom we will be connected before issueing the accept
>
> s= socket(xxx)
> bind(xxx)
> listen(xxxx)
>
> Can we know here to whom we will be connected (ip address of peer)
>
> accept(xxx)


No.

It sounds like what you _might_ want is something that's sometimes
called "lazy accept" -- the ability to look at inbound TCP SYN
messages and decide which ones you want to reply to, rather than
having the stack itself manage SYN-ACK. I don't know of any modern OS
that does this, and unless your application is in the kernel (and in
fact part of TCP itself), there's a serious denial-of-service risk
associated with it.

If what you're looking for is actually just a "peek" mode on accept,
what would you do if you had this? (Is this an inetd "nowait" service
but with libwrap?)

--
James Carlson, KISS Network <james.d.carlson@sun.com>
Sun Microsystems / 1 Network Drive 71.232W Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677
  Réponse avec citation
Vieux 21/11/2006, 18h49   #3
Martijn Lievaart
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Between listen and accept

On Tue, 21 Nov 2006 11:33:01 -0500, James Carlson wrote:

> awahl@yahoo.com writes:
>> In a socket based program,is it possible to know, when returning from
>> listening to whom we will be connected before issueing the accept
>>
>> s= socket(xxx)
>> bind(xxx)
>> listen(xxxx)
>>
>> Can we know here to whom we will be connected (ip address of peer)
>>
>> accept(xxx)

>
> No.
>
> It sounds like what you _might_ want is something that's sometimes
> called "lazy accept" -- the ability to look at inbound TCP SYN
> messages and decide which ones you want to reply to, rather than
> having the stack itself manage SYN-ACK. I don't know of any modern OS
> that does this, and unless your application is in the kernel (and in
> fact part of TCP itself), there's a serious denial-of-service risk
> associated with it.


On Linux you can write it using netfilter queues. Not that I advocate
that, but if you really need that functionality.

Or just use tcpwrappers, it may be exactly what the OP wants.

M4
--
Redundancy is a great way to introduce more single points of failure.

  Réponse avec citation
Vieux 22/11/2006, 17h04   #4
David Schwartz
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Between listen and accept


awahl@yahoo.com wrote:

> In a socket based program,is it possible to know, when returning from
> listening to whom we will be connected before issueing the accept
>
> s= socket(xxx)
> bind(xxx)
> listen(xxxx)
>
> Can we know here to whom we will be connected (ip address of peer)
>
> accept(xxx)


On most TCP/IP stacks, you may be already connected. So the question
doesn't make sense.

DS

  Réponse avec citation
Vieux 23/11/2006, 14h21   #5
awahl@yahoo.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Between listen and accept

Ok thanks to all,

The only think I wanted to know if it was possible to do it within the
socket framework. Apparently it is not.

Too bad.

Aron
David Schwartz wrote:
> awahl@yahoo.com wrote:
>
> > In a socket based program,is it possible to know, when returning from
> > listening to whom we will be connected before issueing the accept
> >
> > s= socket(xxx)
> > bind(xxx)
> > listen(xxxx)
> >
> > Can we know here to whom we will be connected (ip address of peer)
> >
> > accept(xxx)

>
> On most TCP/IP stacks, you may be already connected. So the question
> doesn't make sense.
>
> DS


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 22h25.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12343 seconds with 13 queries