Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
527 views
in Technique[技术] by (71.8m points)

c# - TCP server not receiving data from RFID reader

I am trying to connect to my RFID reader via an ethernet connection. I have connected the RFID reader to my router and then connected my Desktop to the same router via an ethernet connection.

Connection diagram

Every time a RFID tag is detected by the RFID reader the tag's ID will then be sent to my PC. I have writer some very basic TCP server/client code to receive this data. The PC is the server and the RFID reader is the client.

namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
         public Form1()
         {
           InitializeComponent();
         }

         SimpleTcpServer server;

         private void Form1_Load(object sender, EventArgs e)
         {
            server = new SimpleTcpServer();
            server.Delimiter = 0x13;
            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("RFID: {0}", e.MessageString));
            });
         }

         private void buttonStart_Click(object sender, EventArgs e)
         {
            System.Net.IPAddress ip = System.Net.IPAddress.Parse("192.168.5.10");
            server.Start(ip, Convert.ToInt32("6910"));
         }
   }
}

The way the RFID is setup to send the tag data to the PC via ethernet is by using a Macro. This is shown below. So the most important part is the notifyAddress which is in the form of hostname:port.

AutoModeReset
persisttime= 1
AntennaSequence = 0 
AutoAction = Acquire
AutoStartTrigger = 0,0
AutoStopTimer = 0
AutoTrueOutput = 1
AutoTruePause = 1000
TagListCustomFormat = %k 
NotifyAddress = 192.168.5.10:6910
NotifyFormat = Custom
NotifyHeader = Off
NotifyTrigger = True
NotifyMode = On
AutoMode = On

The IP address of the PC/server is 192.168.5.10 with port number 6910. I have created an exception in my firewall for this port. However, I am still not receiving any data from the RFID reader. Can someone assist?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...