
Examples/applications
10.2 RF182C user application
RF182C communication module
Operating Instructions, 10/2010
89
SetTagDetectionState(TagDetectionState.UNDEFINED);
//There may be uncollected data in the buffer --> call ParseBuffer()
ParseBuffer();
// Visualization
Enable(true, false);
labelConnectionState.Text = "NOT CONNECTED";
labelConnectionState.BackColor = Color.Red;
buttonConnect.Text = "Connect";
AsyncError = false;
}
}
/* Connects a stream based TCP/IP socket as client. */
private bool Connect()
{
try
{
//Collect port and IP from the window.
int port = 0;
if (Int32.TryParse(editPort.Text, out port) == false || port <= 0)
{
MessageBox.Show(editIP.Text + " is not a legal port");
return false;
}
IPHostEntry hostEntry = null;
// Get host related information.
hostEntry = Dns.GetHostEntry(editIP.Text);
// Loop through the AddressList to obtain the supported AddressFamily. This is to avoid
// an exception that occurs when the host IP Address is not compatible with the address
family
// (typical in the IPv6 case).
for each (IPAddress address in hostEntry.AddressList)
{
IPEndPoint ipe = new IPEndPoint(address, port);
// stream based TCP/IP socket
Socket tempSocket = new Socket(ipe.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
// the actual connect
tempSocket.Connect(ipe);
if (tempSocket.Connected)
{
//a connection was established successfully
Connection = tempSocket;
Connection.ReceiveTimeout = 25;
break;
}
}
if (Connection == null) return false;
Содержание RF182C
Страница 12: ...Description RF182C communication module 12 Operating Instructions 10 2010 ...
Страница 20: ...Mounting 3 5 Disassembling the RF182C RF182C communication module 20 Operating Instructions 10 2010 ...
Страница 66: ...Maintenance and Service 7 3 Reader update RF182C communication module 66 Operating Instructions 10 2010 ...
Страница 70: ...Diagnostics 8 1 Diagnostics using LEDs RF182C communication module 70 Operating Instructions 10 2010 ...
Страница 122: ...Command and acknowledgement telegrams RF182C communication module 122 Operating Instructions 10 2010 ...
Страница 128: ...Service support RF182C communication module 128 Operating Instructions 10 2010 ...