×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    3

    SocketConnection problem

    hi,

    I need help for reading a response with a socket connection
    I am using the code given here: http://developers.sun.com/mobility/m.../midp2network/

    Code:
    ...
    SocketConnection client = (SocketConnection) Connector.open("socket://" + hostname + ":" + port);
    // set application-specific options on the socket. Call setSocketOption to set other options
    client.setSocketOption(DELAY, 0);
    client.setSocketOption(KEEPALIVE, 0);
    InputStream is = client.openInputStream();
    OutputStream os = client.openOutputStream();
    // send something to server
    os.write("some string".getBytes());
    // read server response
    int c = 0;
    while((c = is.read()) != -1) {
       // do something with the response
    }
    // close streams and connection
    is.close();
    os.close();
    client.close();
    the series 40 5th edition SDK emulator is stuck on the line 'while((c = is.read()) != -1) {'

    I monitor the traffic with wireshark and I can see that everything is ok

    thanks

  2. #2
    Nokia Developer Champion
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: SocketConnection problem

    Hi,
    have u checked the HTTP ResponseCode. Is it HTTP_OK. Please check. Code seems to be right. Any Exception? Are u confirm that is server sending any response message. When u reading the data byte by byte, did u checked that whether control goes to that part or not and if going then what byte is read in variable "c". Checked it with s.o.p. Is ur code runs OK on s60 devices. Please checked out the following suggestions.
    thanks,
    jitu_goldie..

    KEEP TRYING..

Similar Threads

  1. Socket blocking problem
    By durgeshtrivedi in forum Mobile Java Networking & Messaging & Security
    Replies: 8
    Last Post: 2010-06-25, 14:30
  2. Problem with S40 5th Edition emulation, NCF 1.2 and BT dongle
    By nevillesatz in forum Bluetooth Technology
    Replies: 1
    Last Post: 2007-07-05, 10:52
  3. Problem with eglSwapBuffers and heap corruption
    By greatape in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-24, 03:35
  4. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  5. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36

Posting Permissions

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