Hello Everyone,
I am going to get data from Kawasaki robot with ethernet socket. I succesfully get data on KCwinTCP.
on Microsoft visual studio windows form app. Here I can connect to robot. I don't know which port will I use? I have tried different port. but there is no data: (Just Connected)
Actually I want to get data on C# like KCwinTCP
Here Program code. Is there something wrong?:
Code
namespace Kawasaki_Robot
{
public partial class Form1 : Form
{
SimpleTcpServer server; //Server
private void Form1_Load(object sender, EventArgs e)
{
server = new SimpleTcpServer();
server.Delimiter = 0x13; //enter
server.StringEncoder = Encoding.UTF8;
server.DataReceived += Server_DataReceived;
}
private void Server_DataReceived(object sender, SimpleTCP.Message e)
{
try
{
txtStatus.Invoke((MethodInvoker)delegate ()
{
txtStatus.Text += e.MessageString;
e.ReplyLine(string.Format("You said: {0}", e.MessageString));
});
}
catch
{
}
}
private void button6_Click(object sender, EventArgs e)
{
try
{
txtStatus.Text += "Server Starting...\r\n";
System.Net.IPAddress ip = System.Net.IPAddress.Parse(txtHost.Text);
server.Start(ip, Convert.ToInt32(txtPort.Text));
if (server.IsStarted)
{
txtStatus.Text += "Connected\r\n";
}
else
{
txtStatus.Text += "Could not Connect";
}
}
catch(Exception)
{
MessageBox.Show("Server Failed");
}
}
private void button7_Click(object sender, EventArgs e)
{
if (server.IsStarted)
server.Stop();
txtStatus.Text += "Server stop\r\n";
txtStatus.Text += "Disconnected\r\n";
}
}
}
Display More