🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Trying to put vc+ source in bcb

#12613
From: Greg Stantin
Date: Sun, 30 Nov 2003 21:55
86 lines
3021 bytes
I have the following program that i am trying to use the code for
in a bcb program.  I am stuck on one part of the program, and
it wont really do anything unless i get past that part.

void CDNSWatchDlg::OnStartButton()
{
UINT (AFX_CDECL *MyThread)(LPVOID);
-------- snip -------------

MyThread = (DoRawListen);
}

I removed the first line in my program
//UINT (AFX_CDECL *MyThread)(LPVOID);

and the last line i made it just
DoRawListen;

Now the code for that part is:

UINT  DoRawListen(void *pptr)
{
#define DNSPORT 53
#define MAXDNSNAMESIZE 1024

struct sockaddr saddr;
int rc,fromlen=sizeof(struct sockaddr);
PIPHEADER iphdr;
char buf[MAXPACKETSIZE],add_name[MAXDNSNAMESIZE];
//CString szMsg;
String szMsg;

while(1)
{
 if (IsListening == FALSE) break;
rc = recvfrom( hSHandle ,buf,MAXPACKETSIZE,NULL, &saddr, &fromlen);
if ( rc == SOCKET_ERROR )
{
   rc = WSAGetLastError();
   if ( rc != WSAEINPROGRESS )
   {
     //szMsg.Format("recvfrom() failed, error =%d", rc );
     ShowMessage("recvfrom failed!");
       return 1;
   }
}

// Your Filter goes here. Don't do too much processing,
// or you may drop packets
iphdr = (PIPHEADER) buf;
int dsnport = htons(DNSPORT);
if ((iphdr->UDP_src_port == dsnport)  ||
(iphdr->UDP_DEST_port  == dsnport))
{
  if (DoBeep ==true) MessageBeep(5000);
  GetDNSName(&iphdr->data[12], add_name);
  //MYdlg->AddName(add_name);
  Form1->ListBox1->Items->Add(add_name);
}
}
closesocket ( hSHandle );
//AfxEndThread(0);
return 0;
}
//------------------------------------------------------------

There are parts that i changed to make it work in the vcl, but calling
it does nothing for me.  I have this to call it.

void CDNSWatchDlg::OnStartButton()
{
-------- code snip -------------

  DoRawListen;
}

I searched all the files for a "*pptr" but i could not find it
anywhere else.  I tried defining the function as just

DoRawListen(void)

that didn't do any good either, anyone have any idea?  I would like to
see if i can get this to work.


Thanks.
Technical Details
Message-ID: <3fca6766$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,b35d41ac66fac19b,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-11-30 14:09:11 PST
Reply-To: "Greg Stantin" <gstantin@stantonassoc.com>
From: "Greg Stantin" <gstantin@stantonassoc.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Trying to put vc+ source in bcb
Date: Sun, 30 Nov 2003 15:55:53 -0600
Lines: 89
Organization: Stantin Assoc.
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 65.71.58.89
Message-ID: <3fca6766$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1070229350 65.71.58.89 (30 Nov 2003 13:55:50 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail