public class ForumFileClient
{
static InetAddress addr;
static
{
try
{
addr=InetAddress.getByName("127.0.0.1");
}catch(Exception e)
{
e.printStackTrace();
}
}
private Socket socket;
private BufferedReader in;
private PrintWriter out;
public ForumFileClient()
{
try
{
socket=new Socket(addr,ForumFileServer.PORT);
in=new BufferedReader(new InputStreamReader(socket.getInputStream()));
out=new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())),true);
}
catch(Exception e)
{
e.printStackTrace();
}
}
public void closeSocket()
{
try
{
socket.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
/**
* @return Returns the in.
*/
public BufferedReader getIn()
{
return in;
}
/**
* @return Returns the out.
*/
public PrintWriter getOut()
{
return out;
}
/**
* @return Returns the socket.
*/
public Socket getSocket()
{
return socket;
}
}
{
static InetAddress addr;
static
{
try
{
addr=InetAddress.getByName("127.0.0.1");
}catch(Exception e)
{
e.printStackTrace();
}
}
private Socket socket;
private BufferedReader in;
private PrintWriter out;
public ForumFileClient()
{
try
{
socket=new Socket(addr,ForumFileServer.PORT);
in=new BufferedReader(new InputStreamReader(socket.getInputStream()));
out=new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())),true);
}
catch(Exception e)
{
e.printStackTrace();
}
}
public void closeSocket()
{
try
{
socket.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
/**
* @return Returns the in.
*/
public BufferedReader getIn()
{
return in;
}
/**
* @return Returns the out.
*/
public PrintWriter getOut()
{
return out;
}
/**
* @return Returns the socket.
*/
public Socket getSocket()
{
return socket;
}
}