001package edu.wpi.first.wpilibj.networktables2.stream;
002
003import java.io.*;
004import java.net.*;
005
006/**
007 * A socket connection on a standard Java VM
008 * 
009 * @author mwills
010 *
011 */
012public class SocketStream extends SimpleIOStream{
013
014        private final Socket socket;
015        public SocketStream(String host, int port) throws IOException {
016                this(new Socket(host, port));
017        }
018        public SocketStream(Socket socket) throws IOException {
019                super(socket.getInputStream(), socket.getOutputStream());
020                this.socket = socket;
021        }
022
023        public void close() {
024                super.close();
025                try{
026                        socket.close();
027                } catch(IOException e){}
028        }
029
030}