🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Creating sockets

#3805
From: Remy Lebeau (TeamB)
Date: Fri, 29 Apr 2005 18:25
37 lines
2397 bytes
"Jonathan Benedicto" <incorrect@no.server> wrote in message
news:4272519f$1@newsgroups.borland.com...

> CreateListenSocket();

>     lpPerSocketContext = UpdateCompletionPort(sdAccept, ClientIoWrite,
> true);

UpdateCompletionPort() is not a Win32 API function, so I assume it is one of
your own.  What does it look like?

>     nRet = WSASend(sdAccept, &buffSend, 1, &dwRecvNumBytes, dwFlags,
>     &(lpPerSocketContext->pIOContext->Overlapped), NULL);
>     if( nRet == SOCKET_ERROR && (ERROR_IO_PENDING !=
> WSAGetLastError()) )

You should be checking for WSA_IO_PENDING, not ERROR_IO_PENDING.

>     else if( g_bVerbose )
>     {
>         mycprintf("Socket sent greeting\n");
>     }

You are making the assumption that the "greeting" was already sent, without
first waiting for the overlapped I/O to actually complete first.

For that matter, why are you using overlapped I/O on your socket to begin
with?

Also, just for the record, your use of exception handling is horrible in
these code snippets of yours.  You are leaking a lot of resources when you
decide to throw your exceptions because you are not closing/freeing
resources you allocated beforehand.


Gambit
Technical Details
Message-ID: <42727b69$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <42717e9e$1@newsgroups.borland.com> <42718c45$1@newsgroups.borland.com> <4271b145$1@newsgroups.borland.com> <4271c6a8$1@newsgroups.borland.com> <4272519f$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> <42718c45$1@newsgroups.borland.com> <4271b145$1@newsgroups.borland.com> <4271c6a8$1@newsgroups.borland.com> <4272519f$1@newsgroups.borland.com>
Subject: Re: Creating sockets
Date: Fri, 29 Apr 2005 11:25:03 -0700
Lines: 39
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: <42727b69$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1114798953 68.69.17.41 (29 Apr 2005 11:22:33 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail