×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Nov 2007
    Location
    Moratuwa, Sri Lanka
    Posts
    86

    UDP Socket Recieve

    Hi All,

    I have this very strange problem that when i use the following code
    Code:
    User::LeaveIfError( iListen.Open(manager->server, KAfInet, KSockDatagram, KProtocolInetUdp, manager->connection) );	
    	
    	TInetAddr addr;
    	addr.Input(_L("192.168.1.1"));
    	TUint32 aAddr;
    	aAddr =  addr.Address();
    	
    	TInetAddr anyAddrOnPort(aAddr, 100);
    	anyAddrOnPort.SetFamily(KAfInet);
    	User::LeaveIfError( iListen.Bind(anyAddrOnPort) );	
    	
    	dstAddr.Input(_L("192.168.1.2"));
    	dstAddr.SetPort(100);
    	
    	iListen.RecvFrom(iBuffer,dstAddr,0,iStatus);	
    	//SetActive();
    	
    	User::WaitForRequest(iStatus);
    	
    	if(iStatus==KErrNone)
    	{
    		ReqestedIP.Copy(iBuffer);
    		CEikonEnv::InfoWinL(_L("The content is "),ReqestedIP);
    	}	
    	else
    	{
    		CAknInformationNote* infor_rpr_2= new (ELeave) CAknInformationNote;
    		infor_rpr_2->ExecuteLD(_L("Path Rquest not Received"));	
    	}
    If i use SetActive() instead of User::WaitForRequest(iStatus); it does not work (This will not recieve the packet.). What could be the reason ? I have been trying to solve this for past few weeks. Still couldnt do it ... Can any one help me out ?

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,697

    Re: UDP Socket Recieve

    If you use SetActive, the following statements (practically the complete 'if') should be in the RunL. Also make sure that your active object is added to the Active Scheduler.

  3. #3
    Regular Contributor
    Join Date
    Nov 2007
    Location
    Moratuwa, Sri Lanka
    Posts
    86

    Re: UDP Socket Recieve

    Hi Wizard_hu,

    Yes, when i am using SetActive, the complete 'if' is in the RunL() and I have added my active object (current class) to the scheduler as well. Still it is not working.

    Making it worse, I have several active objects in this projects and few are working fine but others are giving this error. What could be the reason ?

    Regards,
    Primal

Similar Threads

  1. ICMP: unreachable destination on UDP socket
    By rafikiel in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2007-09-04, 19:18
  2. problem in persistant socket connection
    By poms4symbian in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2006-01-03, 13:23
  3. j2me支持 udp socket 吗 ?
    By RongJia in forum [Archived] Other Programming Discussion 关于其他编程技术的讨论
    Replies: 5
    Last Post: 2005-09-16, 06:11
  4. My UDP socket can't receive any data
    By djypanda in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2004-12-10, 09:01
  5. Connected UDP Socket for NOKIA 9210
    By Kiran_Balu in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2003-10-14, 14:12

Posting Permissions

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