Skip to content
Snippets Groups Projects
Commit 8f183eea authored by Peter's avatar Peter
Browse files

Started Assignment 1

parent eaaf67a0
No related branches found
No related tags found
No related merge requests found
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.ServerSocket;
import java.net.Socket;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Peter
*/
public class SeversonAssignment1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try {
ServerSocket serverSocket = new ServerSocket(2317);
Socket clientConnection = serverSocket.accept();
OutputStream os = clientConnection.getOutputStream();
PrintStream ps = new PrintStream(os);
ps.println("This client response was written by server TcpExample1"); // to remote client
System.out.println("This server response was written by server TcpExample1"); // to server console
ps.flush();
clientConnection.close();
} catch (IOException ex) {
System.out.println("problem with networking: " + ex);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment