🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

select returns 10022 invalid argument error

#1906
From: jer
Date: Wed, 27 Sep 2006 21:24
32 lines
2837 bytes
Hello, I'm a sockets newb looking for some advice from a vet. I'm using
Borland BCB6, Windows XP SP2, to write a program to communicate with
another computer on a network. I have a thread that sends data out of a
UDP socket periodically to the other computer. Before the sendto
function I always use select to determine if the socket is writable. I
have gotten the software to the point where I am able to send and
receive data correctly most of the time. 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 this point on, I use
select to check if the socket is writable and each time I get
SOCKET_ERROR with 10022.

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". Then I tried pinging localhost
and I get destination unreachable. If I ping any of the network cards
on the PC, even ones unrelated to the socket I'm using, I get
destination unreachable. I also cannot disable or enable any of the
network cards on the PC. The only way to remedy the situation at this
point is to power cycle the PC. Here are my questions:

1. Why would select suddenly timeout after working properly for 10
minutes?
2. Why would I get an invalid argument error after successfully using
the same select code many times before?
3. What could I be doing to break ping? Why can't I ping localhost?

Any hints or help searching for clues would be hugely appreciated.
Thanks,
Jer
Technical Details
Message-ID: <1159392295.406227.295400@e3g2000cwe.googlegroups.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!e3g2000cwe.googlegroups.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,65957817ea9a74e3,start
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!e3g2000cwe.googlegroups.com!not-for-mail
From: "jer" <jer_bred_guy@yahoo.com>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: select returns 10022 invalid argument error
Date: 27 Sep 2006 14:24:55 -0700
Organization: http://groups.google.com
Lines: 33
Message-ID: <1159392295.406227.295400@e3g2000cwe.googlegroups.com>
NNTP-Posting-Host: 205.175.225.24
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1159392300 27635 127.0.0.1 (27 Sep 2006 21:25:00 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 27 Sep 2006 21:25:00 +0000 (UTC)
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.1),gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: e3g2000cwe.googlegroups.com; posting-host=205.175.225.24;
   posting-account=m8Ijew0AAAA3kQiEKttGzmZq2gnboAPt