🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: IP address

#7617
From: Dennis Jones
Date: Sun, 16 Jan 2005 18:16
19 lines
1648 bytes
"imams" <imamsiswanto@yahoo.com.sg> wrote in message
news:41e7a93d$1@newsgroups.borland.com...
>
> I need to know the IP of the computer that runs the apllication,
> and then make an verification wether the computer is allowed
> to connect with the MySQl server or not.

Assuming you are connecting with sockets, and 'SocketHandle' contains
the handle of an open socket, you can do this:

  int iSize = sizeof(struct sockaddr);
  struct sockaddr_in addr;
  getpeername( SocketHandle, (struct sockaddr *)&addr, &iSize );

  char IPAddress[16];
  strcpy( IPAddress, inet_ntoa(addr.sin_addr) );

- Dennis
Technical Details
Message-ID: <41eaaf84@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <41e7177c$1@newsgroups.borland.com> <41e71d69$1@newsgroups.borland.com> <41e72a45$1@newsgroups.borland.com> <41e78327$1@newsgroups.borland.com> <41e7a93d$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,bd82eef6c9c16f3a
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Dennis Jones" <nospam@bogus.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <41e7177c$1@newsgroups.borland.com> <41e71d69$1@newsgroups.borland.com> <41e72a45$1@newsgroups.borland.com> <41e78327$1@newsgroups.borland.com> <41e7a93d$1@newsgroups.borland.com>
Subject: Re: IP address
Date: Sun, 16 Jan 2005 10:16:33 -0800
Lines: 21
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 204.200.27.7
Message-ID: <41eaaf84@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1105899396 204.200.27.7 (16 Jan 2005 10:16:36 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail