Building a Remote Data Logger in Java

Printer QR Code JIS X 0510 in Java Building a Remote Data Logger
7
Quick Response Code Creator In Java
Using Barcode creation for Java Control to generate, create QR-Code image in Java applications.
Building a Remote Data Logger
Create Bar Code In Java
Using Barcode creation for Java Control to generate, create bar code image in Java applications.
public void daemonError(String error) { Systemerrprintln("Error in PPP server:"+error); pppdstopDaemon(); } public boolean isValidUser(String name, String password) { return (thisnameequals(name) && thispasswordequals(password)); } public static void main(String[] args) { Systemoutprintln("Starting DataLogger "); if (argslength != 4) { Systemoutprintln( "Usage: java DataLogger samples delay username password"); Systemexit(1); } try { (new DataLogger(samples, delay, args[2], args[3]))start(); } catch (Exception e) { } } }
Decode Barcode In Java
Using Barcode reader for Java Control to read, scan read, scan image in Java applications.
Since DataLogger is now responsible for validating login requests, we ll add instance elds to store a user name and password Rather than choose arbitrary hard-coded strings to use for validation of login information, we ll modify the main method to require the user name and password on the command line We ll also modify the constructor as well to accept login information and store it in the name and password private instance elds These strings will be used as a direct comparison to the login information passed to the isValidUser method Note that the login scheme that we re supporting in this example with our simple user name and password match is PAP (Password Authentication Protocol) PAP was chosen because it is the most straightforward to implement The main goal of this example is to focus on the mechanics of writing multihomed network servers rather than getting bogged down with security details
QR Code ISO/IEC18004 Maker In C#
Using Barcode creator for .NET framework Control to generate, create QR Code 2d barcode image in .NET applications.
TESTING THE ENTIRE APPLICATION
Draw QR Code JIS X 0510 In VS .NET
Using Barcode printer for ASP.NET Control to generate, create QR Code ISO/IEC18004 image in ASP.NET applications.
Now our remote data logging example is multihomed That is to say that it will accept TCP connections (sockets) from multiple network interfaces speci cally, the PPP and Ethernet interfaces We tested DataLogger over Ethernet only using the DataLoggerClient developed in Section 74 Testing our new PPP functional-
QR-Code Maker In VS .NET
Using Barcode printer for Visual Studio .NET Control to generate, create QR Code ISO/IEC18004 image in .NET framework applications.
Testing the Entire Application
Painting QR Code In Visual Basic .NET
Using Barcode creator for Visual Studio .NET Control to generate, create QR-Code image in Visual Studio .NET applications.
ity is going to take a little more work However, we can use DataLoggerClient without modi cation for testing both interfaces simultaneously The test setup tests the full dial-up networking capabilities provided by PPPDaemon using analog modems and a phone line simulator However, you can also test DataLogger s PPP support using a hard-wired serial connection The test con guration used here includes the following equipment A TINI board running the DataLogger server A Windows 2000 machine dial-up networking client A Linux machine Ethernet networking client Two analog modems one attached to the Windows 2000 PC and the other attached to serial port 0 of the TINI The humidity sensing circuit detailed in Section 443
Generate GS1-128 In Java
Using Barcode creator for Java Control to generate, create UCC-128 image in Java applications.
A diagram of a sample test con guration is shown in Figure 72 This is one of the smallest test con gurations that can be used to test the full networking capabilities of the DataLogger application TINI s network interface IP addresses are 192168015 and 19216811 for Ethernet and PPP, respectively
Making EAN / UCC - 13 In Java
Using Barcode creation for Java Control to generate, create GTIN - 13 image in Java applications.
Ethernet Crossover Cable
Code 128 Generator In Java
Using Barcode encoder for Java Control to generate, create Code-128 image in Java applications.
1921680100 Linux Client
Drawing UPCA In Java
Using Barcode printer for Java Control to generate, create UPC Code image in Java applications.
192168015 TINI (DataLogger) 19216811 RS232 Serial Modem1
Making Bar Code In Java
Using Barcode encoder for Java Control to generate, create bar code image in Java applications.
1 - Wire
Printing USD - 8 In Java
Using Barcode generation for Java Control to generate, create Code11 image in Java applications.
Humidity Sensor
USS Code 128 Printer In C#
Using Barcode generator for Visual Studio .NET Control to generate, create Code 128 Code Set C image in .NET framework applications.
Phone Cable
Printing GS1-128 In Visual Studio .NET
Using Barcode generation for ASP.NET Control to generate, create EAN / UCC - 13 image in ASP.NET applications.
Phone Line Simulator (or PSTN)
Encoding Barcode In Visual Basic .NET
Using Barcode creation for VS .NET Control to generate, create barcode image in VS .NET applications.
Phone Cable
ECC200 Scanner In .NET
Using Barcode decoder for VS .NET Control to read, scan read, scan image in .NET applications.
Modem2
Encoding European Article Number 13 In Visual Studio .NET
Using Barcode encoder for ASP.NET Control to generate, create EAN / UCC - 13 image in ASP.NET applications.
RS232 Serial
Printing Bar Code In C#.NET
Using Barcode creation for VS .NET Control to generate, create bar code image in .NET framework applications.
Win2K Client 19216812
Encoding Code 128 Code Set A In Visual Basic .NET
Using Barcode printer for .NET Control to generate, create ANSI/AIM Code 128 image in Visual Studio .NET applications.
Sample test con guration
To keep the necessary equipment to a minimum, the Linux (Ethernet) client connects directly to TINI using an Ethernet crossover cable The Linux box and TINI could also be connected using straight-through cable with an Ethernet hub The PPP connection is made using two analog modems on either side of a phone
7
Building a Remote Data Logger
line simulator If two different phone lines are available, you can of course use the public phone network instead If we add a couple of debug statements (see Listing 723) to DataLogger s run method, it will display connection information, including both the remote client s IP address and TINI s local interface IP address Listing 723 Adding debug statements
public void run() { while (true) { s = ssaccept(); Systemoutprintln("New client:" + stoString()); Systemoutprintln("Local interface:" + sgetLocalAddress()); } }
Now we can launch DataLogger, supplying the sample count, sample rate, and client authentication information as command line parameters
TINI /> java DataLoggertini 60 120 ducto kid Starting DataLogger
To test the PPP interface, you ll need to create a new dial-up network connection The details on how this is accomplished are platform speci c and are not covered here After you ve created the new dial-up connection, you can use it to manually connect to the TINI or optionally use whatever dial-on demand capability is provided on the client OS Regardless, once you initiate the connection, the following sequence of events occurs 1 2 3 4 5 Client modem dials TINI s modem TINI s modem answers the incoming call PPP option negotiation begins Authentication information is transmitted from the remote peer to TINI IP addresses of TINI and remote peer are established
At this point, the communication link is ready for network traf c After successfully establishing the link, executing the ipconfig -x command at the slush prompt will produce the output shown here Note that the Ethernet and loopback interfaces are not shown for brevity