×

Discussion Board

Results 1 to 3 of 3

Thread: Interface index

  1. #1
    Regular Contributor
    Join Date
    Sep 2006
    Location
    Australia, NSW
    Posts
    200

    Question Interface index

    Hi,


    How can I get interface index when enumerating interfaces using GetOpt with socket option KSoInetNextInterface?

    The option fills in a TSoInetInterfaceInfo structure, but it doesn't contain interface index (a piece of information that I need).
    Code:
    User::LeaveIfError(sock.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl));
    TPckgBuf<TSoInetInterfaceInfo> iface;
    while(sock.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, iface) == KErrNone)
    {
    	// ...
    }
    Alternatively, how can I find interface index at all, using any piece of information (like interface IP address)? I tried GetOpt(KSoInetIfQueryByIndex, KSolInetIfQuery, ...), but it returns -5 (KErrNotSupported).
    Code:
    RSocket sock;
    User::LeaveIfError(sock.Open(serv, KAfInet, KSockDatagram, KProtocolInetUdp));
    
    //...
    
    TPckgBuf<TSoInetIfQuery> ifq;
    ifq().iSrcAddr = someIPAddress;
    
    // this leaves with -5
    User::LeaveIfError(sock.GetOpt(KSoInetIfQueryBySrcAddr, KSolInetIfQuery, ifq));

  2. #2
    Regular Contributor
    Join Date
    Sep 2006
    Location
    Australia, NSW
    Posts
    200

    Re: Interface index

    If anyone is looking for the answer, this question was answered at NewLC.

  3. #3
    Regular Contributor
    Join Date
    Jul 2006
    Posts
    60

    Re: Interface index

    Hi sysctl,

    I got one solution to find interface index. Here is the code snippet that returns my interface index:

    ---------------------------------------------------------------------
    void CClientSocket::testAdapterInfo()
    {
    RSocket iSocket;
    RSocketServ iServer;
    TInt result;

    result = iServer.Connect();
    result = iSocket.Open(iServer,KAfInet,KSockDatagram,KProtocolInetUdp);

    TPckgBuf<TSoInetInterfaceInfo>iface;
    TPckgBuf<TSoInetIfQuery>ifq;


    // init the iterator

    result = iSocket.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl);

    while(iSocket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, iface) == KErrNone)
    {
    TSoInetInterfaceInfo &info = iface();

    if(info.iState == EIfUp){
    ifq().iName = info.iName;
    result = iSocket.GetOpt(KSoInetIfQueryByName, KSolInetIfQuery, ifq); // returns 0
    result = ifq().iIndex; // returns index (in my case, returns 2)


    }
    }
    }
    --------------------------------------------------------------------------
    Cheers!!!!

    Tonmoy

Similar Threads

  1. ScrollPane, PP on Nokia 9500 Emu
    By pkc2k in forum Personal Profile
    Replies: 1
    Last Post: 2005-12-06, 16:58
  2. List index with FindBox
    By microteq in forum Symbian User Interface
    Replies: 4
    Last Post: 2005-05-08, 22:53
  3. HTTP POST failing and discrepancy of string tables in SDK and 6600
    By cas_dominic in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2004-05-31, 08:08
  4. Any algorithm of wav compression
    By kingsimba in forum Symbian
    Replies: 3
    Last Post: 2004-01-03, 09:00
  5. N30 iocontrol interface
    By patgraf in forum Nokia M2M
    Replies: 2
    Last Post: 2002-10-25, 08:13

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×