×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    153

    Problem with sockets

    I have a problem with binding the socket with an IP address, The code is ..................

    -----------------***************--------------------------------------

    const TUint32 KInetAddress = INET_ADDR(................);

    User::LeaveIfError(iListener.Open(iSocketServ, KAfInet, KSockStream, KProtocolInetTcp));

    iAddress.SetAddress(KInetAddress);

    iAddress.SetPort(1500);

    TInt iTest=iListener.Bind(iAddress);

    ---------------------**************-------------------------------------

    The iTest variable is returning a value of -1 and socket couldn't able to bind to the IP address given.The previous steps of connecting to socket server and opening a new socket were successful.i was struck at this binding step.

    Furthermore, when i use the IP address as KInetAddrAny,it was successfully binding, Can we able to retrieve the IP address to which the socket has binded to by giving IP address as KInetAddrAny.Can't we bind this socket with my own IP address?

    Also,i tried the sockets example in SDK but i couldn't able to establish a connection with the default IP address 127.0.0.1 and port 7.What modifications should i do in the code or settings in order to establish a connection with the server?

    Please help me in this regard

    Thanks in advance
    Last edited by tripiri; 2004-11-25 at 05:42.

  2. #2
    Nokia Developer Expert
    Join Date
    Aug 2004
    Posts
    53
    U may want to try this.

    iRemotePort = 7;
    iRemoteAddr = _L("127.0.0.1");
    iLocalPort = 2080;
    iLocalAddr = _L("127.0.0.1");

    iSendAddr.SetPort(iRemotePort); // remote port
    iSendAddr.Input(iRemoteAddr) ; // remote address

    // set the local port
    iRecAddr.SetPort(iLocalPort); // own port


    err = iSocket.Open( iSocketServer, KAfInet, KSockStream, KProtocolInetTcp);

    err = iSocket.SetLocalPort(iLocalPort);

    //setting the local port is equivalent to calling Bind() with only the port set in the address.

  3. #3
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    153
    Thanks ekhoo for ur prompt response,i succeed in binding the socket.

    But the problem with the client still persists.I was trying the Sockets example of SDK but i couldn't able to connect to the server with any IP address. i have tried with the IP address u have given i.e, 127.0.0.1 with the port 7,but it is giving an error code of -34.

    I have seen that this error code represents "FAILED TO CONNECT", how can i make this example work and what all modifications should i do in order to successfully connect to a server?

    I have installed the Ethernet Plug-in and assigned an IP address to the emulator and able to ping this IP address.

    Please help me to do the necessary changes either in the configuration or the code.I'm currently working on Windows XP and connected to a LAN.

    Thanks in Advance

  4. #4
    Nokia Developer Expert
    Join Date
    Nov 2004
    Posts
    22

    Same problem here too

    Hi,
    I am getting the same problem for several days. I am also refering to an Example on Forum Nokia Site named "Series 60 Developer, Platform 2.0: HTTP Client Example"
    This work for SDK 2.1 only and the too on the release version of the SDK. Try this.

  5. #5
    Nokia Developer Expert
    Join Date
    Nov 2004
    Posts
    22

    Emulator Configuration

    I have configured the emulator on win 2000. If you have an XP installation that is NOT PERSONAL then you should not have any problem connecting to the network.

    I have configure the Emulator for SDK 2.0 and SDK 2.1 both the procedure is as follows

    SDK 2.0
    a. Download a ETHERNET configuration tool from Forum Nokia or NewLC
    b. run it it will flicker the emulator a couple of times.
    c. Uncheck the Promiscode mode Tick.
    d. Put in your gateway, DNS IP .. (use ipconfig -all on cmd prompt)
    e. The IP that you assign to the emulator should not conflict with any IP on the Network.
    f. Click the Adapters button.
    g. read the text the black screen shows.
    h. choose the adapter that is connected to your gateway.

    SDK 2.1
    Step a is not required since the tool is preinstalled ....rest all is same in that too

  6. #6
    Nokia Developer Expert
    Join Date
    Nov 2004
    Posts
    22

    Answer to SDk 2.0 problem

    I have recieved a mail from a source in ---forum nokia which is as follow: -

    You should use Series 60 SDK 2.1 for both Series 60 2.0 and 2.1 devices.
    There were problems with connectivity in the older SDK. As long as you dontuse any of the new APIs introduced on 2.1 for an application that is to run
    on 2.0 devices, things should work fine.

    so I am on my way to create a program based on SDK 2.0 API ....

  7. #7
    Nokia Developer Expert
    Join Date
    Nov 2004
    Posts
    22

    SDK 2.0

    from the Http socket client example make a key word search of the API class name it will fetch you no result in the 2.0 sdk help .
    Which makes it clear that these API's are not supported in 2.0 but in 2.1 it gives a valid search answer.

  8. #8
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    153

    SDK 2.0

    Hi tapan,

    I would like to add some suggestions to your previous reply that the SDK 2.0 is also posing some serious problems in the connectivity in either using the Sockets Example or HTTP Example in SDK 2.0

    But all the examples are working perfectly in SDK 2.1 by making the required configuration settings in beforehand.

    Cheers,
    Sunil

Posting Permissions

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