Linux MIPS Architecture development
 help / color / mirror / Atom feed
* Socket problem?
@ 2004-05-22  8:02 Gill
  2004-05-22  8:02 ` Gill
  2004-05-22 16:06 ` Jan-Benedict Glaw
  0 siblings, 2 replies; 7+ messages in thread
From: Gill @ 2004-05-22  8:02 UTC (permalink / raw)
  To: linux-mips

Hi -

Has anyone come across a socket problem where the user app calls select() on
a set of sockets, which returns, indicating that data is waiting...then
subsequent recvfrom() call returns -1 indicating that there's nothing
there??

I'm using linux v2.4.2, IPv4, and the ethernet driver is pcnet32.  We're
receiving a UDP stream.

I'm trying to check for dropped packets.  /proc/net/snmp indicates a number
of UDP InErrors (~1 per second).  However, not yet sure whether this is a
consequence of the problem above, or cause of it.

Any help much appreciated!

/Gill

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Socket problem?
  2004-05-22  8:02 Socket problem? Gill
@ 2004-05-22  8:02 ` Gill
  2004-05-22 16:06 ` Jan-Benedict Glaw
  1 sibling, 0 replies; 7+ messages in thread
From: Gill @ 2004-05-22  8:02 UTC (permalink / raw)
  To: linux-mips

Hi -

Has anyone come across a socket problem where the user app calls select() on
a set of sockets, which returns, indicating that data is waiting...then
subsequent recvfrom() call returns -1 indicating that there's nothing
there??

I'm using linux v2.4.2, IPv4, and the ethernet driver is pcnet32.  We're
receiving a UDP stream.

I'm trying to check for dropped packets.  /proc/net/snmp indicates a number
of UDP InErrors (~1 per second).  However, not yet sure whether this is a
consequence of the problem above, or cause of it.

Any help much appreciated!

/Gill

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Socket problem?
  2004-05-22  8:02 Socket problem? Gill
  2004-05-22  8:02 ` Gill
@ 2004-05-22 16:06 ` Jan-Benedict Glaw
  2004-05-24  8:25   ` Gill
  1 sibling, 1 reply; 7+ messages in thread
From: Jan-Benedict Glaw @ 2004-05-22 16:06 UTC (permalink / raw)
  To: linux-mips

[-- Attachment #1: Type: text/plain, Size: 1533 bytes --]

On Sat, 2004-05-22 09:02:48 +0100, Gill <gill.robles@exterity.co.uk>
wrote in message <000001c43fd3$2c25a350$2000a8c0@gillpc>:
> Hi -
> 
> Has anyone come across a socket problem where the user app calls select() on
> a set of sockets, which returns, indicating that data is waiting...then
> subsequent recvfrom() call returns -1 indicating that there's nothing
> there??

Read the select() manpage again. Upon successful return, it's guaranteed
that the very next read() on a file descriptor contained in the result
set won't block. Typically, it's the case after data arrived, but
returning -1 *immediately* (with no blocking) is okay, too.

> I'm using linux v2.4.2, IPv4, and the ethernet driver is pcnet32.  We're
> receiving a UDP stream.

Quite aged version, though perfectly correct on select() behaviour.

> I'm trying to check for dropped packets.  /proc/net/snmp indicates a number
> of UDP InErrors (~1 per second).  However, not yet sure whether this is a
> consequence of the problem above, or cause of it.

Neither - nor. You've got a small thinko in your application. Albeit
that: update your kernel version... It most probably contains a number
of known root exploits.

MfG, JBG

-- 
   Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481
   "Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg
    fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!
   ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Socket problem?
  2004-05-22 16:06 ` Jan-Benedict Glaw
@ 2004-05-24  8:25   ` Gill
  2004-05-24  8:25     ` Gill
  2004-05-24  9:13     ` Jan-Benedict Glaw
  0 siblings, 2 replies; 7+ messages in thread
From: Gill @ 2004-05-24  8:25 UTC (permalink / raw)
  To: 'Jan-Benedict Glaw', linux-mips

Hi -

To clarify, more specifically select() returns a positive value, and a
subsequent call to FD_ISSET() returns TRUE for one of the sockets the app is
listening on.  Then, app calls recvfrom() which returns (sometimes) -1.
Problem occurs sporadically...I'm seeing it every hundred or so packets at
the moment, but it varies.


Thanks,
Gill

-----Original Message-----
From: linux-mips-bounce@linux-mips.org
[mailto:linux-mips-bounce@linux-mips.org] On Behalf Of Jan-Benedict Glaw
Sent: 22 May 2004 17:07
To: linux-mips@linux-mips.org
Subject: Re: Socket problem?


On Sat, 2004-05-22 09:02:48 +0100, Gill <gill.robles@exterity.co.uk> wrote
in message <000001c43fd3$2c25a350$2000a8c0@gillpc>:
> Hi -
> 
> Has anyone come across a socket problem where the user app calls 
> select() on a set of sockets, which returns, indicating that data is 
> waiting...then subsequent recvfrom() call returns -1 indicating that 
> there's nothing there??

Read the select() manpage again. Upon successful return, it's guaranteed
that the very next read() on a file descriptor contained in the result set
won't block. Typically, it's the case after data arrived, but returning -1
*immediately* (with no blocking) is okay, too.

> I'm using linux v2.4.2, IPv4, and the ethernet driver is pcnet32.  
> We're receiving a UDP stream.

Quite aged version, though perfectly correct on select() behaviour.

> I'm trying to check for dropped packets.  /proc/net/snmp indicates a 
> number of UDP InErrors (~1 per second).  However, not yet sure whether 
> this is a consequence of the problem above, or cause of it.

Neither - nor. You've got a small thinko in your application. Albeit
that: update your kernel version... It most probably contains a number of
known root exploits.

MfG, JBG

-- 
   Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481
   "Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg
    fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!
   ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM |
TCPA));

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Socket problem?
  2004-05-24  8:25   ` Gill
@ 2004-05-24  8:25     ` Gill
  2004-05-24  9:13     ` Jan-Benedict Glaw
  1 sibling, 0 replies; 7+ messages in thread
From: Gill @ 2004-05-24  8:25 UTC (permalink / raw)
  To: 'Jan-Benedict Glaw', linux-mips

Hi -

To clarify, more specifically select() returns a positive value, and a
subsequent call to FD_ISSET() returns TRUE for one of the sockets the app is
listening on.  Then, app calls recvfrom() which returns (sometimes) -1.
Problem occurs sporadically...I'm seeing it every hundred or so packets at
the moment, but it varies.


Thanks,
Gill

-----Original Message-----
From: linux-mips-bounce@linux-mips.org
[mailto:linux-mips-bounce@linux-mips.org] On Behalf Of Jan-Benedict Glaw
Sent: 22 May 2004 17:07
To: linux-mips@linux-mips.org
Subject: Re: Socket problem?


On Sat, 2004-05-22 09:02:48 +0100, Gill <gill.robles@exterity.co.uk> wrote
in message <000001c43fd3$2c25a350$2000a8c0@gillpc>:
> Hi -
> 
> Has anyone come across a socket problem where the user app calls 
> select() on a set of sockets, which returns, indicating that data is 
> waiting...then subsequent recvfrom() call returns -1 indicating that 
> there's nothing there??

Read the select() manpage again. Upon successful return, it's guaranteed
that the very next read() on a file descriptor contained in the result set
won't block. Typically, it's the case after data arrived, but returning -1
*immediately* (with no blocking) is okay, too.

> I'm using linux v2.4.2, IPv4, and the ethernet driver is pcnet32.  
> We're receiving a UDP stream.

Quite aged version, though perfectly correct on select() behaviour.

> I'm trying to check for dropped packets.  /proc/net/snmp indicates a 
> number of UDP InErrors (~1 per second).  However, not yet sure whether 
> this is a consequence of the problem above, or cause of it.

Neither - nor. You've got a small thinko in your application. Albeit
that: update your kernel version... It most probably contains a number of
known root exploits.

MfG, JBG

-- 
   Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481
   "Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg
    fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!
   ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM |
TCPA));

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Socket problem?
  2004-05-24  8:25   ` Gill
  2004-05-24  8:25     ` Gill
@ 2004-05-24  9:13     ` Jan-Benedict Glaw
  2004-05-24  9:13       ` Jan-Benedict Glaw
  1 sibling, 1 reply; 7+ messages in thread
From: Jan-Benedict Glaw @ 2004-05-24  9:13 UTC (permalink / raw)
  To: linux-mips

[-- Attachment #1: Type: text/plain, Size: 1519 bytes --]

On Mon, 2004-05-24 09:25:43 +0100, Gill <gill.robles@exterity.co.uk>
wrote in message <000501c44168$b4718800$2000a8c0@gillpc>:
> Hi -
> 
> To clarify, more specifically select() returns a positive value, and a
> subsequent call to FD_ISSET() returns TRUE for one of the sockets the app is
> listening on.  Then, app calls recvfrom() which returns (sometimes) -1.
> Problem occurs sporadically...I'm seeing it every hundred or so packets at
> the moment, but it varies.

That sounds perfectly okay.

>From SuS V3:
-------------------------------------------------------------------
A descriptor shall be considered ready for reading when a call to an
input function with O_NONBLOCK clear would not block, whether or not the
function would transfer data successfully. (The function might return
data, an end-of-file indication, or an error other than one indicating
that it is blocked, and in each of these cases the descriptor shall be
considered ready for reading.)
-------------------------------------------------------------------

So everything is perfectly okay, and because you have to do proper error
checking anyways, that shouldn't disturb your application at all.

MfG, JBG

-- 
   Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481
   "Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg
    fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!
   ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Socket problem?
  2004-05-24  9:13     ` Jan-Benedict Glaw
@ 2004-05-24  9:13       ` Jan-Benedict Glaw
  0 siblings, 0 replies; 7+ messages in thread
From: Jan-Benedict Glaw @ 2004-05-24  9:13 UTC (permalink / raw)
  To: linux-mips

[-- Attachment #1: Type: text/plain, Size: 1518 bytes --]

On Mon, 2004-05-24 09:25:43 +0100, Gill <gill.robles@exterity.co.uk>
wrote in message <000501c44168$b4718800$2000a8c0@gillpc>:
> Hi -
> 
> To clarify, more specifically select() returns a positive value, and a
> subsequent call to FD_ISSET() returns TRUE for one of the sockets the app is
> listening on.  Then, app calls recvfrom() which returns (sometimes) -1.
> Problem occurs sporadically...I'm seeing it every hundred or so packets at
> the moment, but it varies.

That sounds perfectly okay.

From SuS V3:
-------------------------------------------------------------------
A descriptor shall be considered ready for reading when a call to an
input function with O_NONBLOCK clear would not block, whether or not the
function would transfer data successfully. (The function might return
data, an end-of-file indication, or an error other than one indicating
that it is blocked, and in each of these cases the descriptor shall be
considered ready for reading.)
-------------------------------------------------------------------

So everything is perfectly okay, and because you have to do proper error
checking anyways, that shouldn't disturb your application at all.

MfG, JBG

-- 
   Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481
   "Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg
    fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!
   ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-05-24  9:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-22  8:02 Socket problem? Gill
2004-05-22  8:02 ` Gill
2004-05-22 16:06 ` Jan-Benedict Glaw
2004-05-24  8:25   ` Gill
2004-05-24  8:25     ` Gill
2004-05-24  9:13     ` Jan-Benedict Glaw
2004-05-24  9:13       ` Jan-Benedict Glaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox