copying INetAddr variable to (1)another InetAddr variable (2)RWriteStream

Login to reply to this topic.
Wed, 2007-08-22 05:47
Joined: 2007-05-15
Forum posts: 137


Dear friends,
I need to copy INetAddr variable to (1)another InetAddr variable (2)RWriteStream

to copy INetAddr variable to another InetAddr variable
--------------------------------------------------------------------------------
I am using

TInetAddr iIpAddress;
TInetAddr& aIpAddress;

iIpAddress= aIpAddress;

to copy INetAddr variable to RWriteStream
--------------------------------------------------------------------------------

I am using

TInetAddr iIpAddress;
RWriteStream& aStream;
aStream<< iIpAddress;

Is it the right way to do these things?
If there is any better way , then please help!!!


Thu, 2007-08-23 11:15
Joined: 2007-05-15
Forum posts: 137
Re: copying INetAddr .....................

d

Thu, 2007-08-23 11:13
Joined: 2007-05-15
Forum posts: 137
Re: copying INetAddr .....

Wed, 2007-08-22 07:28
Joined: 2007-05-15
Forum posts: 137
Re: copying INetAddr .........

I found some problem in storing and retrieving
TTime iTime;
TTimeIntervalSeconds iTimeOffset;
TTime iDate;
TInetAddr iIpAddress;

objects into stream.

I tried using
RWriteStream& aStream;
aStream<< iTime;
aStream<< iTimeOffset;

aStream<< iDate;

aStream< < iIpAddress;

Can anyone tell how to write these objects into stream????????

also TInt objects are not written into Stream with << operator-------------------

RWriteStream& aStream;
TInt iColor;
aStream<< iColor;

and I had to use

RWriteStream& aStream;
TInt iColor;
aStream.WriteInt32L(iColor);

Thu, 2007-08-23 10:33
Joined: 2007-05-15
Forum posts: 137
Re: copying INetAddr ........

fOLLOWING CODE WORKS FOR STORING AND RETRIEVING InetAddr INTO Stream

InetAddr iIpAddress;
TBuf<30> bufTime;
FOR WRITING TO STREAM
-----------------------------------------

iIpAddress.Output(bufTime);
aStream<

FOR READING FROM STREAM
-------------------------------------------
aStream>>bufTime;
iIpAddress.Input(bufTime);

BUT I DID NOT GET SOLN AS FOR TTime and TTimeIntervalSeconds Objects????????

CAN ANY ONE THROW ANY LIGHT ON IT!!!!!!!!!!!!!!!!!!!!!!

Thu, 2007-08-23 13:28
Joined: 2005-02-18
Forum posts: 100
Re: copying INetAddr variable to (1)another InetAddr variable (2

TBuf<30> bufTime;

Make the size at least 39, or you will only get buffer filled with *'s, when the address happens to be IPv6 address. See

http://www.symbian.com/developer/techlib/v9.1docs/doc_source/reference/reference-cpp/N102B6/TInetAddrClass.html#%3a%3aTInetAddr%3a%3aOutput%28%29

Fri, 2007-08-24 16:17
Joined: 2004-11-29
Forum posts: 1232
Re: copying INetAddr variable to (1)another InetAddr variable (2

Or even better, don't use the unecessary extra buffer.

Just wrap the memory of your original T-variable in a TPtr, as I suggested in your time-thread:

TIntetAddr addr;
TPtr8 ptr((TUint8*)&addr,sizeof(addr));

aWriteStream.WriteL(ptr);

  • Login to reply to this topic.