🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #17658

Re: getsockopt

#17658
From: Remy Lebeau (TeamB)
Date: Sat, 08 Mar 2003 21:39
25 lines
1735 bytes
Did you test the return value of getsockopt() to make sure it even succeeded
to begin with?  You should also initialize your int variable, otherwise it
will get a random value, which if getsockopt() fails, your code will
interpret incorrectly:

    int sockType = 0,
    if( getsockopt(s , SOL_SOCKET , SO_TYPE,  (char FAR *)&sockType,
sizeof(sockType) == 0 )
        // use sockType as needed
    else
        // error

Also, how are you creating/retreiving the socket descriptor to begin with?


Gambit

"Boguslaw Fries" <B.Fries@luca-online.de> wrote in message
news:3e6a47b9@newsgroups.borland.com...

> int sockType,
>  getsockopt( s , SOL_SOCKET , SO_TYPE,
> ( char FAR * ) &sockType, sizeof( sockType ))
>  returns invalid type - sockType == 2  but should be 1
> ( TCP not UDP )
Technical Details
Message-ID: <3e6a60f4$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3e6a47b9@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,dfa415dfd2f786cf
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-03-08 13:38:17 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3e6a47b9@newsgroups.borland.com>
Subject: Re: getsockopt
Date: Sat, 8 Mar 2003 13:39:29 -0800
Lines: 27
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3e6a60f4$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1047159028 207.175.226.26 (8 Mar 2003 13:30:28 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail