🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #1907

Re: select returns 10022 invalid argument error

#1907
From: Remy Lebeau (TeamB)
Date: Wed, 27 Sep 2006 23:28
60 lines
2850 bytes
"jer" <jer_bred_guy@yahoo.com> wrote in message
news:1159392295.406227.295400@e3g2000cwe.googlegroups.com...

> Before the sendto function I always use select to determine if the socket
is writable.

That is generally not a good idea.  You should just call sendto() by itself,
and let it report an error if it cannot send.

> However, intermittently, the select statement times out (I set it to
> a 3 sec timeout).  When this happens I skip the sendto function and try
> the select again. At this point, select returns SOCKET_ERROR and
> I get a 10022 error (invalid argument) when I call WSAGetLastError().

From the select() documentation:

    WSAEINVAL
    The timeout value is not valid, or all three descriptor parameters were
NULL.

Please show your actual socket code.

> From this point on, I use select to check if the socket is writable and
> each time I get SOCKET_ERROR with 10022.

My guess would be that your socket is no longer valid.

> After this happens, I have tried to diagnose what is going on in
> the PC. I have tried pinging the other computer on the network,
> and I always get "destination unreachable".

You lost your network connection.  Try rebooting the machine, and
double-check the network wires.

> Then I tried pinging localhost and I get destination unreachable.

You probably blew up the TCP/IP stack altogether.  Pinging the localhost
should never fail when TCP/IP is working properly.

> Why would select suddenly timeout after working properly for 10
> minutes?

Hard to say without seeing your actual code.

> Why would I get an invalid argument error after successfully
> using the same select code many times before?

Because the socket is no longer valid.

> What could I be doing to break ping?

Hard to say without seeing your actual code.

> Why can't I ping localhost?

Because TCP/IP is not working properly anymore.


Gambit
Technical Details
Message-ID: <451b09bf$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <1159392295.406227.295400@e3g2000cwe.googlegroups.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,65957817ea9a74e3
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <1159392295.406227.295400@e3g2000cwe.googlegroups.com>
Subject: Re: select returns 10022 invalid argument error
Date: Wed, 27 Sep 2006 16:28:50 -0700
Lines: 62
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 69.169.4.232
Message-ID: <451b09bf$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1159399871 69.169.4.232 (27 Sep 2006 16:31:11 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail