source: tmcsimulator/branches/trunk/src/atmsdriver/model/HighwayStatusWriter.java @ 84

Revision 84, 842 bytes checked in by jtorres, 9 years ago (diff)

FEPSimulator.cpp: FEPSimulator socket server is now receiving full messages, no more partial messages over the TCP socket. General housekeeping on FEPSim.cpp, NetworkReader?.cpp, ATMSDriver.java, NetworkLoader?.java.

Line 
1/*
2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
5 */
6package atmsdriver.model;
7
8import java.io.BufferedReader;
9import java.io.IOException;
10import java.io.InputStreamReader;
11import java.io.PrintWriter;
12import java.net.Socket;
13
14/**
15 *
16 * @author jtorres
17 */
18class HighwayStatusWriter {
19   
20    private final String host;
21    private final int port;
22   
23    public HighwayStatusWriter(String host, int port)
24    {
25        this.host = host;
26        this.port = port;
27    }
28   
29    public void write(String xml) throws IOException
30    {
31        Socket sock = new Socket(host, port);
32        PrintWriter out = new PrintWriter(sock.getOutputStream(), true);
33        out.println(xml);
34        sock.close();
35    }
36}
Note: See TracBrowser for help on using the repository browser.