Article View: borland.public.cppbuilder.internet.socket
Article #3800Re: Creating sockets
From: Remy Lebeau (TeamB)
Date: Fri, 29 Apr 2005 01:24
Date: Fri, 29 Apr 2005 01:24
32 lines
1836 bytes
1836 bytes
"Jonathan Benedicto" <incorrect@no.server> wrote in message
news:42717e9e$1@newsgroups.borland.com...
> hints.ai_flags = AI_PASSIVE;
> hints.ai_family = AF_INET;
> hints.ai_socktype = SOCK_STREAM;
> hints.ai_protocol = IPPROTO_TCP;
>
> if( getaddrinfo(NULL, g_Port, &hints, &addrlocal) != 0 )
> throw Exception(myprintf("getaddrinfo() failed with error %d\n",
> WSAGetLastError()));
Why are you using that code? You don't need it. It doesn't gain you
anything that you can't simply do directly:
struct sockaddr_in addrlocal = {0};
addrlocal.sin_family = AF_INET;
addrlocal.sin_port = YourPortNumber;
addrlocal.sin_addr = INADDR_ANY;
nRet = bind(g_sdListen, (sockaddr*) &addrlocal, sizeof(addrlocal));
> nZero = 0;
> nRet = setsockopt(g_sdListen, SOL_SOCKET, SO_SNDBUF, (char *)&nZero,
> sizeof(nZero));
Why are you setting the sending buffer size to 0?
Gambit
Technical Details
Message-ID:
<42718c45$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<42717e9e$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,890efe40447445cf 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: <42717e9e$1@newsgroups.borland.com> Subject: Re: Creating sockets Date: Thu, 28 Apr 2005 18:24:31 -0700 Lines: 34 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: 68.69.17.41 Message-ID: <42718c45$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1114737733 68.69.17.41 (28 Apr 2005 18:22:13 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail