Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    28

    Help with Receiving RTP / UDP data over Wi-Fi

    Hello,

    I am working on a little program that sends RTP/UDP packet data (just text data right now) to another Symbian device over a Wi-Fi network. I have the sending class done and it appears to work right now by running as a Active Object that after every second it prepares and sends new data to a remote IP Address on the same network. The Receiving side is not working and I am at a stump as to what is the problem. I took the RTP Example code from the SDK under the \devices\S60_5th_Edition_SDK_v1.0\Examples\MultimediaProtocols\RTPExample directory. The sample connects 2 sockets with an RTP Session on the same device and then sends data across the sockets from one class to another. I tried unwrapping the example into two discrete classes: Sender and Receiver, but I cannot get the Receiver to recognize that data is coming in and fire off the callback function to create a new source and start the process of receiving the incoming data and saving it to a file. If anyone can help I would appreciate the clarification, since there is not any code samples of how to perform RTP/UDP connectionless receiving of data on a phone. I am using 2 5th edition phones (5800 and a N97) and using Carbide.c++. The essential Receiver code is below.

    _LIT(KDestPort,"5005" );
    _LIT(KLocalPort,"5004" );
    _LIT(KSize,"100" );

    void CSRtpReceiver::ConstructL()
    {
    //Connect to the File Server and replace old existing file
    User::LeaveIfError(iRFs.Connect());
    User::LeaveIfError(iDestFile.Replace(iRFs,KdFileName,EFileWrite));

    TBufC<10> destStr(KDestPort);
    TLex parser;
    TInt num;
    parser.Assign(destStr);
    User::LeaveIfError(parser.Val(num));
    TInetAddr localAddr(KInetAddrAny, num);
    localAddr.SetFamily(KAfInet);

    //Create some Server Session preference stuff
    TRequestStatus mStatus;
    TSessionPref prefs;
    prefs.iAddrFamily = KAfInet;
    prefs.iProtocol = KProtocolInetIp;
    User::LeaveIfError(iSocketServ.Connect(prefs, KESockDefaultMessageSlots));
    User::WaitForRequest(mStatus);
    User::LeaveIfError(mStatus.Int());

    User::LeaveIfError(iSocket.Open(iSocketServ, KAfInet,KSockDatagram, KProtocolInetUdp));
    User::LeaveIfError(iSocket.Bind(localAddr));

    TBufC<10> pktSizeStr(KSize);
    parser.Assign(pktSizeStr);
    User::LeaveIfError(parser.Val(num));
    iSession.OpenL(iSocket, num);
    iSession.SetBandwidth( 300000); //in bps
    iSession.PrivRegisterEventCallbackL((TUint)(ERtpNewSource|ERtpNotOneShot),
    (TRtpCallbackFunction)CSRtpReceiver::NewSource, (TAny*)this);
    }

    /**
    A callback method that is called when a packet with a new SSRC arrives.
    */
    void CSRtpReceiver::NewSource(TAny* aPtr, const TRtpEvent& aEvent)
    {
    CSRtpReceiver* temp = (CSRtpReceiver*)aPtr;
    if (temp->ReceiveSrc().IsOpen())
    {
    temp->ReceiveSrc().Close();
    }
    TRAPD(err, temp->ReceiveSrc() = aEvent.Session().NewReceiveSourceL();
    temp->ReceiveSrc().PrivRegisterEventCallbackL( (TUint)(ERtpPacketReceived|ERtpNotOneShot),
    (TRtpCallbackFunction)CSRtpReceiver::PacketArrived, (TAny*)temp)
    if (err!=KErrNone)
    {
    __DEBUGGER();
    }
    }

    /**
    A callback method that is called on packet arrival.
    */
    void CSRtpReceiver::PacketArrived(TAny* aPtr, const TRtpEvent& aEvent)
    {
    CSRtpReceiver* temp = (CSRtpReceiver*)aPtr;
    temp->iRecvPacket.Close();
    temp->iRecvPacket = aEvent.ReceiveSource().Packet();
    if (aEvent.ReceiveSource().Packet().IsOpen())
    {
    __DEBUGGER();
    }
    TRAPD(err,temp->HandleReceivedPacketL(aEvent));
    if (err!=KErrNone)
    {
    __DEBUGGER();
    }
    }

    /**
    An instance method called by the static callback function to
    be called on packet arrival.
    */
    void CSRtpReceiver::HandleReceivedPacketL(const TRtpEvent& aEvent)
    {
    //iObserver is a reference to my UI Form that will display a message on the screen
    if (iObserver)
    {
    iObserver->NotifyPacketReceived();
    }
    TPtrC8 writeDesc( iRecvPacket.Payload().Ptr(), iRecvPacket.Payload().Length());
    User::LeaveIfError(iDestFile.Write(writeDesc));
    }

  2. #2
    Registered User
    Join Date
    Jul 2011
    Posts
    1

    Re: Help with Receiving RTP / UDP data over Wi-Fi

    Hi MBFonz,

    I am new to Symbian technology and i am starting to learn about it,
    I was wondering if can please provide me some code for PDP session i.e. how it is establish, how data is sent and receive
    I am in need to know how the hole session is maintained, when session is disconnected, when started and all the other stuff related to PDP session
    it will be great if you can provide me those

    Thanks in advance

Similar Threads

  1. Receiving data from PHP server to j2me
    By amishra in forum Mobile Java Networking & Messaging & Security
    Replies: 6
    Last Post: 2010-11-11, 16:39
  2. VoIP and wi-fi power-save mode
    By ng1234 in forum VoIP
    Replies: 6
    Last Post: 2009-07-06, 13:05
  3. suckho, i have encontered the same problems. Could you tell me how you resolved it?
    By dicson_hu in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2005-12-09, 11:56
  4. Replies: 2
    Last Post: 2004-09-15, 22:47
  5. Card Phone and receiving data calls
    By chinazou305 in forum Multimodecards
    Replies: 3
    Last Post: 2002-11-05, 19:43

Posting Permissions

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