|
RE: connect() retry returning EINVAL
|
10/22/2008 9:51 AM
post15400
|
RE: connect() retry returning EINVAL
Without the source, I can only guess the sockaddr you passed in, have a
wrong sa_len. The sockaddr MUST initilized like this:
struct sockaddr_in sin;
memset(&sin, 0, sizeof(sin));
sin.sin_len = sizeof(sin);
sin.sin_family = AF_FAMILY;
sin.sin_port = ...
sin.sin_addr = ...
-xtang
> -----Original Message-----
> From: Christoph Nemmaier [mailto:community-noreply@qnx.com]
> Sent: Wednesday, October 22, 2008 9:40 AM
> To: general-networking
> Subject: connect() retry returning EINVAL
>
> Hello,
>
> I'm porting a program to QNX that communicates via TCP. It
> tries to connect() to a server, and retries connect() calls
> until it is finally found. This program runs on Linux, even
> Windows, and others, but not on Neutrino. Here, only the
> first connect() call fails with the expected ECONNREFUSED,
> but retries using the identical parameter list yield EINVAL,
> even if the server has become available in the meantime.
>
> I tried to find documentation about the differences in
> behaviour, but to no avail. Momentics help does not even
> mention EINVAL to be a possible errno return code. Can
> somebody tell me why connect() behaves differently, and what
> to do about it?
>
> TIA
> Christoph Nemmaier
>
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post15399
>
>
|
|
|
|
Re: connect() retry returning EINVAL
|
10/22/2008 10:03 AM
post15403
|
Re: connect() retry returning EINVAL
On Wed, Oct 22, 2008 at 09:40:22AM -0400, Christoph Nemmaier wrote:
> Hello,
>
> I'm porting a program to QNX that communicates via TCP. It tries to connect() to a server, and retries connect()
calls until it is finally found. This program runs on Linux, even Windows, and others, but not on Neutrino. Here, only
the first connect() call fails with the expected ECONNREFUSED, but retries using the identical parameter list yield
EINVAL, even if the server has become available in the meantime.
>
> I tried to find documentation about the differences in behaviour, but to no avail. Momentics help does not even
mention EINVAL to be a possible errno return code. Can somebody tell me why connect() behaves differently, and what to
do about it?
>
> TIA
> Christoph Nemmaier
That's non standard behaviour. The BSD's (and QNX) don't support it.
You have to close() and get a new socket. See the following links.
http://mail-index.netbsd.org/tech-net/2003/06/17/0002.html
http://mail-index.netbsd.org/tech-net/2003/06/17/0003.html
Regards,
-seanb
|
|
|