TCP And Character Encoding

  • Thread starter Siddharth Sood via .NET 247
  • Start date
S

Siddharth Sood via .NET 247

Hi,

I am having a real issue with sending data across a network.

I have a string that is composed of the following:

NEW|192.168.0.12|_000000038|_000000001|_000000109|312886|1|0|_000000001|C|AUTO-ASSIGN|??| ||EN|

I am using the method below to send this string to another systemover tcp that accepts the data over port 5021.

All data is transferred to the other system except the "??". Thisis in hindi or it can be in any other language. The problemarises when the other system receives the data; the "??" isdisplayed as ???. How do i send a string in a diffrent languageover TCP. Your help is appreciated.

public string GetToken(string tosend)
{
try
{
m_socWorker = new Socket(AddressFamily.InterNetwork,SocketType.Stream, ProtocolType.Tcp);
string szIPSelected = GetIPaddress();
string szPort =System.Configuration.ConfigurationSettings.AppSettings["RemotePort"];
int alPort = System.Convert.ToInt16(szPort,10);
System.Net.IPAddress remoteIPAddress =System.Net.IPAddress.Parse(szIPSelected);
System.Net.IPEndPoint remoteEndPoint = newSystem.Net.IPEndPoint(remoteIPAddress, alPort);
m_socWorker.Connect(remoteEndPoint);

Object objData = tosend;
byte[] byData =System.Text.Encoding.ASCII.GetBytes(objData.ToString ());
m_socWorker.Send(byData);
}
}


Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top