×

Discussion Board

Results 1 to 1 of 1
  1. #1
    Regular Contributor
    Join Date
    Sep 2008
    Location
    India
    Posts
    126

    Question Problem while writing on perticular port using socket

    Hi All,

    1. I wrote following code to write on perticular port.
    2. On the same Device I have listener (written in JAVA).
    3. My SocketWrite Application is able to invoke that Listener application but there is some problem regarding write socket code.
    4. SocketWrite App invokes that Listener many times and every time it Listener says connection successful >> availbale bytes 0.



    void CSocketActiveObjectClass::ConstructL()
    {

    myLogFile = LogFile::NewL();

    //Provides the Connect() function to create an IPC communication channel to the socket server.
    User::LeaveIfError(iSocketServ.Connect());
    CleanupClosePushL(iSocketServ);
    myLogFile->writeLog(_L("iSocketServ.Connect()"));

    iWriteSocket.Open(iSocketServ, KAfInet, KSockStream, KProtocolInetTcp);
    myLogFile->writeLog(_L("iWriteSocket.Open"));

    const TInt KEchoPort= 5002;
    TInetAddr destAddr;
    const TUint32 KInetAddr=INET_ADDR(127,0,0,1);
    destAddr.SetAddress(KInetAddr);
    destAddr.SetFamily(KAfInet);
    destAddr.SetPort(KEchoPort);
    iWriteSocket.Connect(destAddr, aStaus);
    myLogFile->writeLog(_L("iWriteSocket.Connect"));
    _LIT(KStartingString,"Hello");
    TInt KSMSMessageLength = 50;
    HBufC* message = HBufC::NewLC(KSMSMessageLength);
    TPtr16 ptr = message->Des();
    ptr.Append((const TDes16&)KStartingString);
    const TDesC8& iBody = (TDesC8&)ptr;
    myLogFile->writeLog(_L("message created\n"));
    iWriteSocket.Write(iBody,aStaus);

    CActiveScheduler::Add( this); // Add to scheduler
    SetActive();
    }
    5. Initially I put iWriteSocket.Write(iBody,aStaus);
    in RunL .... to invoke after iWriteSocket.Connect(destAddr, aStaus); 's success.

    6. But by any way it giving same problem.

    Please help me if any one can guess .... where I m wrong?

    Thanks and Regards,
    Kranti
    Last edited by Kranti; 2008-11-06 at 12:37.

Similar Threads

  1. Socket connecting problem of Samsung device
    By cha9651 in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2008-11-10, 07:49
  2. XML writing and Appending the Problem
    By talk2mishal in forum Mobile Java General
    Replies: 3
    Last Post: 2008-09-19, 19:24
  3. Problem of socket connection with N70
    By isa550 in forum Mobile Java Networking & Messaging & Security
    Replies: 8
    Last Post: 2006-07-12, 14:10
  4. Socket problem
    By Smeetesh Ooka in forum Mobile Java General
    Replies: 1
    Last Post: 2004-10-07, 21:20

Posting Permissions

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