I am creating an attendance marking system in using visual studio 2010 and Sql server 2008R2.And an RFID card for each members.I am using third party device AR800P-TCP as RFID reader,It has RJ45 port to connect with PC.i want to read data from card to my project using RJ45 port.How it possible. Write some code i tried is:
try
{
IPAddress ipAd = IPAddress.Parse("122.174.226.76");
/* Initializes the Listener */
TcpListener myList = new TcpListener(ipAd, 8001);
/* Start Listeneting at the specified port */
myList.Start();
Console.WriteLine("The server is running at port 8001...");
Console.WriteLine("The local End point is :" +
myList.LocalEndpoint);
string sw = "The local End point is :" + myList.LocalEndpoint;
textBox1.Text = sw;
Console.WriteLine("Waiting for a connection.....");
Socket s = myList.AcceptSocket();
// Console.WriteLine("Connection accepted from " + s.RemoteEndPoint);
string sw1 = "Connection accepted from " + s.RemoteEndPoint;
textBox2.Text = sw1;
byte[] b = new byte[100];
int k = s.Receive(b);
Console.WriteLine("Recieved...");
for (int i = 0; i < k; i++)
Console.Write(Convert.ToChar(b[i]));
// string sw3 = Convert.ToChar(b[i])
ASCIIEncoding asen = new ASCIIEncoding();
s.Send(asen.GetBytes("The string was recieved by the server."));
Console.WriteLine("\nSent Acknowledgement");
/* clean up */
s.Close();
myList.Stop();
}