Symbian Developer Network

   
 

Need help using the forums?
Click here

Home » Symbian Developer Network Forums » Discussion Groups » Symbian C++

Thread: -46 error with socket in UIQ SDK. in S60 3d fp1 working fine.

Legend
  • Five stars: 251 - 10000 pts
  • Four stars: 101 - 250 pts
  • Three stars: 51 - 100 pts
  • Two stars: 11 - 50 pts
  • One star: 1 - 10 pts
  • No stars: 0 - 0 pts
Helpful Answer (1 pts)
Correct Answer (2 pts)

Permlink Replies: 7 - Pages: 1 - Last Post: 07-Jul-2008 18:37 Last Post By: tanzimhusain
vkazakov

Posts: 12
Registered: 23/06/08
-46 error with socket in UIQ SDK. in S60 3d fp1 working fine.
Posted: 01-Jul-2008 14:16
Click to report abuse...   Click to reply to this thread Reply
Hi Symbian and UIQ masters.
I making a programm wich usuing sockets, RSocket::Connect gives error -46, what i doing wrong?
This example working fine.
I using capability: AllFiles NetworkControl NetworkServices ProtServ ReadDeviceData ReadUserData SwEvent UserEnvironment WriteDeviceData WriteUserData

Here is my code:

TBuf<256> iServer;
TInt iPort;
TInt err = 0;
TBuf8<128> iserver8;

iserver8 = (TUint8 *) hostname;

ConvertRev(iserver8, iServer);

iPort = port;

err = iSocketServ.Connect();
if( err != KErrNone )
{
User::LeaveIfError(err);
}

err = iConnection.Open(iSocketServ, KConnectionTypeDefault);
if( err != KErrNone )
{
User::LeaveIfError(err);
}

TNameEntry entry;

err = addr.Input(iServer);

if(err != KErrNone)
{
err=iResolver.Open(iSocketServ, KAfInet, KProtocolInetTcp);
err=iResolver.GetByName(iServer,entry);

//error = 0 here!!! resolver passed OK

if(err != KErrNone)
{
User::LeaveIfError(err);
}

TNameRecord name=entry();

TInetAddr::Cast(name.iAddr).Output(iServer);
addr=entry().iAddr;

iResolver.Close();
}
else
{
addr.Output(iServer);
}

TCommDbConnPref prefs;
prefs. SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
prefs.SetDirection(ECommDbConnectionDirectionOutgoing);


err = iConnection.Start(/*prefs*/);

if( err != KErrNone )
{
User::LeaveIfError(err);
}

err = iSocket.Open(iSocketServ,KAfInet,KSockStream,KProtocolInetTcp);
if(err != KErrNone)
{
User::LeaveIfError(err);
}

User::LeaveIfError( iSocket.SetOpt(KSoInetEnumInterfaces,KSolInetIfCtrl)
);


iPort = port;
addr.SetPort(iPort);

iSocket.Connect( addr, iStatus );
User::LeaveIfError(iStatus.Int());
;


//HERE IS ERROR -46


Please give me answers from your experience, don't give me a links!!!!

adetaylor

Posts: 41
Registered: 19/01/07
Re: -46 error with socket in UIQ SDK. in S60 3d fp1 working fine.
Posted: 01-Jul-2008 14:18   in response to: vkazakov in response to: vkazakov
Click to report abuse...   Click to reply to this thread Reply
A complete guess, but when you call RSocket::Open perhaps you should pass in the iConnection which you have opened?

Adrian
vkazakov

Posts: 12
Registered: 23/06/08
Re: -46 error with socket in UIQ SDK. in S60 3d fp1 working fine.
Posted: 01-Jul-2008 14:36   in response to: adetaylor in response to: adetaylor
Click to report abuse...   Click to reply to this thread Reply
I passing iConnection.Start without error.
adetaylor

Posts: 41
Registered: 19/01/07
Re: -46 error with socket in UIQ SDK. in S60 3d fp1 working fine.
Posted: 01-Jul-2008 15:03   in response to: vkazakov in response to: vkazakov
Click to report abuse...   Click to reply to this thread Reply
No, I meant, instead of

err = iSocket.Open(iSocketServ,KAfInet,KSockStream,KProtocolInetTcp);

try

err = iSocket.Open(iSocketServ,KAfInet,KSockStream,KProtocolInetTcp, iConnection);
vkazakov

Posts: 12
Registered: 23/06/08
Re: -46 error with socket in UIQ SDK. in S60 3d fp1 working fine.
Posted: 01-Jul-2008 15:09   in response to: adetaylor in response to: adetaylor
Click to report abuse...   Click to reply to this thread Reply
Just now I have tryed your way, I got the same I error -46.
hamishw

Posts: 2,286
Registered: 11/10/06
Re: -46 error with socket in UIQ SDK. in S60 3d fp1 working fine.
Posted: 02-Jul-2008 05:44   in response to: vkazakov in response to: vkazakov
Click to report abuse...   Click to reply to this thread Reply
-46 is a platsec error. Given that you appear to have ability to get granted more capabilities than most you might want to see what happens if you give the process all capabilities. If that works you can identify which capability is missing (trial and error - yuk). If it doesn't then you know that this is possibly some other error being incorrectly propagated.

Regards
Hamish
tomg

Posts: 21
Registered: 19/02/07
Re: -46 error with socket in UIQ SDK. in S60 3d fp1 working fine.
Posted: 04-Jul-2008 15:26   in response to: hamishw in response to: hamishw
Click to report abuse...   Click to reply to this thread Reply
Probably you have PlatSec enforcement disabled for the S60 SDK - mine defaulted to:

PlatSecDiagnostics ON
PlatSecEnforceSysBin ON
PlatSecProcessIsolation ON
PlatSecEnforcement OFF

(look in "epoc32\data\epoc.ini"). If you look in debugger output or in %TEMP%\EPOCWIND.OUT you'll probably see warning diagnostics for your code on S60, and they should give a better idea of what's missing.

I don't see an immediate cause for your -46 (you should of course be waiting for that Connect() to complete but that's not (directly) giving you the problem
tanzimhusain

Posts: 270
Registered: 23/11/07
Re: -46 error with socket in UIQ SDK. in S60 3d fp1 working fine.
Posted: 07-Jul-2008 18:35   in response to: tomg in response to: tomg
Click to report abuse...   Click to reply to this thread Reply
Was bitten quite a bit while verifying the sampe code for Quick Recipes on Symbian OS. Anyway, wrote down what needs to be done after S60 SDK installation here: http://www.tanzim.co.uk/2008/07/06/setting-up-the-s60-sdk-for-development/

Point your RSS reader here for a feed of the latest messages in all forums