I've just found out that when I connect, the Series 60 Sockets examples for instance, to 63.105.0.43 port 80 like:

iSocket.Open ( iSocketServ, KAfInet, KSockStream, KProtocolInetTcp )
iSocket.Connect ( iAddress, iStatus );

In an CActive derived class of course, that Connect will actually set iStatus to KErrNone even though a connection, a confirmed TCP/IP connection can NOT be made!!!!

Is this normal? Am I overlooking something???

I tried a fiew more things and the results are not what I like at all.

All I can conclude so far is that RSocket/RSocketServ is NOT like BSD sockets on the contrary of what the documentation says.

BSD sockets drop rather quickly when a connection with an IP address can not be established and return an error on 'connect'.

RSocket in all cases seems to return success, but does not really connect (of course). So my question is. How the heck can I find out weither or not an RSocket is actually connected or not???



void MyClass :: Test ()
{
Test ( _L ( "63.105.9.42" ) ); // This one should connect.
Test ( _L ( "63.105.9.43" ) ); // This one SHOULD NOT!!!!
}



void MyClass :: Test ( const TDesC & address )
{
RSocketServ ss;
RSocket s;
TInetAddr a;
TRequestStatus status;
TBuf8 < 128 > str;


if ( ss.Connect () != KErrNone )
return;

if ( s.Open ( ss, KAfInet, KSockStream, KProtocolInetTcp ) != KErrNone )
return;

if ( a.Input ( address ) != KErrNone )
return;

a.SetPort ( 80 );

status = KRequestPending;

s.Connect ( a, status );
User :: WaitForRequest ( status );

// This works just fine and returns KErrNone at all times.
// It does not matter if the socket is actually connected or not.

if ( status == KErrNone )
{
s.Write ( _L8 ( "........................................" ), status );
User :: WaitForRequest ( status );
}

// This is even funnier...
// It returns -33 == KErrTimedOut on 63.105.9.42 which is fine.
// It returns -25 == KErrEof on 63.105.9.43 as if there EVER was a connection.

if ( status == KErrNone )
{
s.Read ( str, status );
User :: WaitForRequest ( status );
}

L_TRACE1 ( _L8 ( "Status: %d\n\n" ), status.Int () );

s.Close ();
ss.Close ();
}

Thanks!
Jan
ManiaC++