Im using a UDPClient Send to send message to the server heres my code:
MsgProperties _msgPro = new MsgProperties() ;
byte[] bs = System.Text.Enc oding.UTF8.GetB ytes( _msgPro._seqNo +
_msgPro._msgLen + Message);
x = thisClient.Send (bs,(int) bs.Length, RemoteEndPoint) ;
and the struct is
[StructLayout(La youtKind.Explic it)]
public struct MsgProperties
{
[FieldOffset(0)]
public short _seqNo;
[FieldOffset(2)]
public short _msgLen;
[FieldOffset(4)]
public short _checkSum;
}
the problem is:
1.) i want _msgPro._seqNo + _msgPro._msgLen + Message to be concatenated and
not plus. I need it to be on the right bytes in sending and in receiving..
any good ideas?
2.) How can i get for example the 1st 2 bytes or the next 2 bytes of a
string... ?
3.) Can i place _msgPro._seqNo, _msgPro._msgLen & _msgPro._checkS um in one
variable? what type? how?
I would really appreciate any help.. i really cant understand how to do
this.. please help.. than you so much in advance.
MsgProperties _msgPro = new MsgProperties() ;
byte[] bs = System.Text.Enc oding.UTF8.GetB ytes( _msgPro._seqNo +
_msgPro._msgLen + Message);
x = thisClient.Send (bs,(int) bs.Length, RemoteEndPoint) ;
and the struct is
[StructLayout(La youtKind.Explic it)]
public struct MsgProperties
{
[FieldOffset(0)]
public short _seqNo;
[FieldOffset(2)]
public short _msgLen;
[FieldOffset(4)]
public short _checkSum;
}
the problem is:
1.) i want _msgPro._seqNo + _msgPro._msgLen + Message to be concatenated and
not plus. I need it to be on the right bytes in sending and in receiving..
any good ideas?
2.) How can i get for example the 1st 2 bytes or the next 2 bytes of a
string... ?
3.) Can i place _msgPro._seqNo, _msgPro._msgLen & _msgPro._checkS um in one
variable? what type? how?
I would really appreciate any help.. i really cant understand how to do
this.. please help.. than you so much in advance.
Comment