×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Nov 2006
    Location
    Brebes, Indonesia
    Posts
    129

    Proble wit socket writer

    I have try sending data with socket example from sdk. but i have problem.
    In sample KWriteBufferSize set to 20, so i can send 20 character, but i want to send data more than 20 character, i try the code
    WriteL(_L8("11111111111111111111"));
    WriteL(_L8("22222222222222222222"));
    WriteL(_L8("33333333333333333333"));
    But the code just can transfer 11111111111111111111 data. 22222222222222222222 and 33333333333333333333 can't be transfer.
    Please help me.
    Thanks for respons
    http://blogehendrawan.blogspot.com - Kembangin symbian di Indonesia yukk....

  2. #2
    Regular Contributor
    Join Date
    Sep 2006
    Posts
    280

    Re: Proble wit socket writer

    Can you please paste some snippet of your code and also the error that you
    get while transferring.

    Regards.

  3. #3
    Super Contributor
    Join Date
    Oct 2005
    Location
    Hyderabad,India
    Posts
    1,156

    Re: Proble wit socket writer

    hi,
    isnt socket write() a asynchronous one? i dont find any variables of TRequestStatus in your write().
    once your write() returns you could check the status of the TRequestStatus variable and draw out a conclution whether the write was successfull or not.

    Priju

  4. #4
    Regular Contributor
    Join Date
    Nov 2006
    Location
    Brebes, Indonesia
    Posts
    129

    Re: Proble wit socket writer

    Sorry i have some mistake in my server. Now sockets writer run very well, but i have 1 problem. How to detect while all text in file has been read and send in WriteL(). this my code
    void CWAPServSocketsEngine::WriteL(const TDesC8& aData)
    {
    // Write data to socket
    if (iEngineStatus == EConnected)
    {
    iSocketsWriter->IssueWriteL(aData);
    }
    }

    void CWAPServSocketsEngine::ReadFile(const TDesC8& aFileName)
    {
    TBuf<255> KUrl;
    TBuf<255> iFileName;
    TInt flagRead = 0;
    iFileName.Copy(aFileName);
    KUrl.Format(_L("z:\\docs\\%S"), &iFileName);
    flagRead = 0;

    TBuf8<25> content;

    RFs aRfs;
    RFile file;

    User::LeaveIfError(aRfs.Connect());
    CleanupClosePushL(aRfs);
    if (file.Open(aRfs,KUrl,EFileRead) == KErrNone)
    {
    CleanupClosePushL(file);

    TInt fileSize;
    file.Size(fileSize);

    while ( flagRead <= fileSize)
    {
    file.Read(flagRead, content, 20);
    WriteL(content);
    flagRead = flagRead+20;
    }
    file.Close();
    CleanupStack::PopAndDestroy();
    }
    else
    {
    WriteL(_L8("Can't get a file"));
    }
    CleanupStack::PopAndDestroy();
    }
    with the code i just can send 2 times. my file size is 88 bytes and have abaut 82 character.
    Thanks for respons.
    http://blogehendrawan.blogspot.com - Kembangin symbian di Indonesia yukk....

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: Proble wit socket writer

    You can check the length of "content" after the read. If it is less than 20, you have reached the end of the file. You might also check the return value of RFile::Read; it might be KErrEof when you reach the end of the file.

  6. #6
    Regular Contributor
    Join Date
    Nov 2006
    Location
    Brebes, Indonesia
    Posts
    129

    Re: Proble wit socket writer

    Ok i will try your idea
    http://blogehendrawan.blogspot.com - Kembangin symbian di Indonesia yukk....

Similar Threads

  1. problem in persistant socket connection
    By poms4symbian in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2006-01-03, 13:23
  2. Replies: 0
    Last Post: 2005-09-20, 03:58
  3. S60 - C++ - Socket Client - Reading SMS in Binay from InBox and Write to a socket?
    By www_peach in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2005-09-20, 03:56
  4. Socket problem
    By defragger in forum Symbian
    Replies: 0
    Last Post: 2005-08-25, 08:16

Posting Permissions

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