我用的ISDN,怎样获得此链接的IP地址??

解决方案 »

  1.   

    是本机的IP地址,还是连接中对方的IP地址?
      

  2.   

    ipconfig /all
    对方的不知道
      

  3.   

    假如你用的是ras,可以用rasgetprojectioninfo好象就是他,假如不是肯定类似的函数你也可以查找ras函数
      

  4.   

    这个不知在你的ISDN有没有作用:
    http://expert.csdn.net/Expert/topic/1376/1376202.xml?temp=.1463739
      

  5.   

    本地的很简单。http://nowcan.yeah.net#include <windows.h>
    #include <winsock.h>
    #include <stdio.h>int main(int argc, char **argv)
    {
    WORD wVersionRequested;
    WSADATA wsaData;
    LPSTR szIPAddr;
    hostent *p;//Start up WinSock
    wVersionRequested = MAKEWORD(1, 1);
    if(WSAStartup(wVersionRequested, &wsaData))
    {
    printf("ERROR No.1!!! Program Terminate.");
    return 0;
    }char s[128];
    char *p2;
    DWORD dwIPAddr;
    //Get the computer name
    if(gethostname(s, 128)==SOCKET_ERROR)
    {
    printf("ERROR No.2!!! Program Terminate.");
    return 0;
    }p = gethostbyname(s);
    if(!p)
    {
    printf("ERROR!!! Bad host lookup. Program Terminate.");
    return 0;
    }printf("Local Computer Name: %s\n",s);
    printf("Local Host Name: %s\n",p->h_name);
    int i=0;
    while(p->h_aliases[i])
    {
    printf(" %s\n",p->h_aliases[i]);
    i++;
    }
    //Get the IpAddress
    for(int i=0;p->h_addr_list[i]!=0;i++)
    {
    p2 = inet_ntoa(*((in_addr *)p->h_addr_list[i]));
    printf("Local IP Adress: %s\n",p2);
    }
    return 0;

      

  6.   

    http://expert.csdn.net/Expert/topic/1362/1362628.xml?temp=.2990991