L
localhost
Network socket client code works correctly:
byte[] nameBytes = new byte[2048];
recvData = inStream.Read( nameBytes , 0 , 1024 );
string fileNameRaw = System.Text.Encoding.UTF8.GetString( nameBytes );
string fileName = fileNameRaw.Substring( 0 ,
fileNameRaw.IndexOf("***") );
Console.WriteLine( fileName );
Network socket server code works correctly:
int fileNameCharLength = fileName.Length + 3 ;
byte[] nameBytes =
System.Text.Encoding.UTF8.GetBytes( fileName + "***" );
networkStream.Write( nameBytes , 0 , fileNameCharLength );
networkStream.Flush();
But if I change the encoding to BigEndianUnicode, it does not work.
How should the encoding change to handle that?
Thanks.
byte[] nameBytes = new byte[2048];
recvData = inStream.Read( nameBytes , 0 , 1024 );
string fileNameRaw = System.Text.Encoding.UTF8.GetString( nameBytes );
string fileName = fileNameRaw.Substring( 0 ,
fileNameRaw.IndexOf("***") );
Console.WriteLine( fileName );
Network socket server code works correctly:
int fileNameCharLength = fileName.Length + 3 ;
byte[] nameBytes =
System.Text.Encoding.UTF8.GetBytes( fileName + "***" );
networkStream.Write( nameBytes , 0 , fileNameCharLength );
networkStream.Flush();
But if I change the encoding to BigEndianUnicode, it does not work.
How should the encoding change to handle that?
Thanks.