Linux Driver for the
RadioShack 12-258 S.A.M.E. Weather Radio

A Simple Java Client

This is an example of a simple Java client. See the downloads section for a more comprehensive Java client example.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.Socket;


public class WxrClient {
    public static void main(String[] args) {
        BufferedReader is = null; 
        Socket s = null; 
        try {
            // open a connection to the server on port 9317
            s = new Socket("localhost", 9317);
            is = new BufferedReader(new InputStreamReader(
                    s.getInputStream()));
            String responseLine;
            // wait for the server to send data
            while ((responseLine = is.readLine()) != null) {
                // server has sent a message, print it
                System.out.println("Server: " + responseLine);
            }
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}

<<Previous Page | Index | Next Page>>