×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    4

    Simple RSocket Application in emulator

    Hi All,

    I'm trying to run a simple (connectionless) socket-application on the emulator.
    This is the meat of the code (I use an active object and iSocketServ is connected):
    Code:
    	// define, open, bind a local socket desc
    	RSocket socket; 
    	User::LeaveIfError(socket.Open(iSocketServ, KAfInet, KSockDatagram, KProtocolInetUdp));
    
    	// set the dest address: udp/ip addr
    	TSockAddr sourceAddress(TInetAddr(INET_ADDR(127,0,0,1), 1074));
    
    	if ( socket.Bind(sourceAddress) != KErrNone )
    		{
    		socket.Close();
    		//User::LeaveIfError(err);
    		}
    
    	TInt len = 500;
    	TSockXfrLength aLen = len;
    
    	// set the constant data buffer
    	TPtrC8 aDesc ( (TUint8 *) "TEST data for UDP of size 350");
    
    	// set the dest address: udp/ip addr
    	TSockAddr destinationAddress(TInetAddr(INET_ADDR(192,168,0,59), 1075));
    	socket.SendTo(aDesc, destinationAddress, KSIConnectionLess|KSIMessageBased, iStatus, aLen);
    	SetActive();
    
    	socket.Close();
    When I execute it on the emulator I get a -5 (no such operation) as a response (in the RunL-method)
    I Use:
    - Symbian OS 7.0 (Series 60 SDK 2.0)
    - SIP-plugin
    - Ethernet Plugin
    - VS .Net 2003
    - Ethereal for monitoring.

    I've tried:

    - 'Setting up Ethernet connection' with the manual from symbian. No result in ethereal.

    - Modify and re-import the cedout.cfg:
    Code:
    	[ConnectionPreferences]
    		ADD_SECTION
    			Ranking=1
    			Direction=OUTGOING
    			DialogPref=DONOTPROMPT
    			BearerSet=LAN
    			IAP=1
    			FIELD_COUNT=5
    		END_ADD
    Still no result.

    - using prnesock.lib instead of esock.lib, I get an 'unhandled exception' when te sendTo-method is called.

    Does anyone have any idea?

    Swivel

  2. #2
    Registered User
    Join Date
    Jan 2005
    Location
    Helsinki, Finland
    Posts
    257

    Re: Simple RSocket Application in emulator

    Hello,

    I see something is wrong in your code if all those code belongs to the same method. You are closing the socket (socket.close()) after making asynchronous call socket.SendTo(). You should close the socket in RunL() when the socket is no longer needed.

  3. #3
    Regular Contributor
    Join Date
    Jun 2005
    Location
    Philippines
    Posts
    163

    Smile Re: Simple RSocket Application in emulator

    Active object usage is something not available in at least PC side C++ and Java languages. I had a hard time understanding that at first and the RunL() function.

Similar Threads

  1. How to run my application in J-Sky emulator
    By bb_sathya in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2005-09-01, 08:12
  2. simple bluetooth application
    By yenkay in forum Bluetooth Technology
    Replies: 0
    Last Post: 2005-01-21, 13:02
  3. how to delete make application from emulator?
    By khinsen in forum Symbian Tools & SDKs
    Replies: 4
    Last Post: 2005-01-21, 01:37
  4. Replies: 3
    Last Post: 2004-08-05, 08:46
  5. Sending recordstore contents from emulator to another application
    By cpboland in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2003-12-28, 16:39

Posting Permissions

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