Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Nov 2004
    California, USA

    Question question about RSocket::Read() usage.

    I'm interested in comparing POSIX and Symbian's socket APIs. My initial Symbian program is inspired by Stevens's daytime example (see http://www.kohala.com/start/). His example is a UNIX/C program which is equivalent to this telnet command.

    % telnet time-a.nist.gov 13

    53706 05-12-02 19:23:42 00 1 0 381.5 UTC(NIST) *

    When I wrote the Symbian version, I used the RSocket::Read(). I give my descriptor buffer a length of 64. Power of two and long enough to read the string entire string in one go. When I run the program on 7.0s, it fails. iStatus is set to KErrEof and the buffer discriptor is empty. So, I changed the buffer size to 16 which is less than the size of the string. This time the program works as expected. Read() fills the buffer descriptor with the first 16 characters and the iStatus is KErrNone.

    Since it is rare for the last read call to completely fill the buffer, this behavior seems strange. Although it does seems consistent with the SDK definition. How does one use the RSocket::Read() with the length of the data received is unknown?



  2. #2
    Super Contributor
    Join Date
    Nov 2004
    Wiltshire, UK

    Re: question about RSocket::Read() usage.

    I for one when recieving binary data, normally have a state machine where I have the length of a packet as the first byte then normally a command code in the second byte.

    This is pretty much standard. Have a look at RecvOneOrMore and keep reading until either your end of link marker is returned or the server disconnects.

Similar Threads

  1. Strange question on 6230
    By DanAvni1 in forum Mobile Web Site Development
    Replies: 1
    Last Post: 2005-04-18, 06:05
  2. Question about Threads and processor usage (yield/wait)
    By aspaans in forum Mobile Java General
    Replies: 1
    Last Post: 2004-03-03, 16:20
  3. Usage of System.gc() - not a question but tip :)
    By dpolyakov in forum Mobile Java General
    Replies: 2
    Last Post: 2003-12-28, 16:43
  4. Replies: 1
    Last Post: 2003-06-16, 07:58
  5. Sending data using iAcceptedSocket (Urgent question)
    By okegame in forum Bluetooth Technology
    Replies: 1
    Last Post: 1970-01-01, 02:00

Posting Permissions

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