Closed aykuter closed 6 years ago
Haven’t seen that before - what is the hex character of that odd character?
Hex output is 13 for this char
You can check the link. Here is my codes for server :
`namespace Lister_Server { public partial class Form1 : Form {
SimpleTcpServer server;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
server = new SimpleTcpServer();
//server.Delimiter = 0x13;
server.Delimiter = 0x0A;
server.StringEncoder = Encoding.UTF8;
server.DataReceived += Server_DataReceived;
}
private void Server_DataReceived(object sender, SimpleTCP.Message e)
{
txtStatus.Invoke((MethodInvoker)delegate ()
{
txtStatus.Text += e.MessageString;
e.ReplyLine(string.Format("You said: {0}", e.MessageString));
});
}
private void btnStart_Click(object sender, EventArgs e)
{
if (!server.IsStarted)
{
System.Net.IPAddress ip = System.Net.IPAddress.Parse(textIp.Text);
server.Start(ip, Convert.ToInt32(textPort.Text));
}
}
private void btnStop_Click(object sender, EventArgs e)
{
if (server.IsStarted)
server.Stop();
}`
I'm calling this code from client :
client.WriteLineAndGetReply(txtMessage.Text, TimeSpan.FromSeconds(1));
I'm using VS2017, Windows 8.1 64bit, NET framework 4.6.1
Split method working now. I copied that character from that link. I can't see that character on visual studio but it's working. It's really weird problem. I can use it like that but it will cause problem for everyone.
Make sure to set your client delimiter to the same as the server delimiter... I believe both default to 0x13 if you don’t set them.
I already set server delimiter but i forget for client. It's fixed now. Is there any way to use null delimiter ? cuz i want to check if message == test etc. Thanks for the help!
If i send text "Hey" to the server i'm getting response like "You said: Hey". Why it's adding extra character to it ? I can't parse that text to.
I set server.Delimiter to 0x0A but nothing changed.
txtStatus.Text += e.MessageString.Split('!')[0]; // It's not working it's still responding with "!".
Am i doing something wrong ? Thanks!
Here some info for !! chracter : https://apps.timwhitlock.info/unicode/inspect?s=%13