delete_tcp.java Source code

Java tutorial

Introduction

Here is the source code for delete_tcp.java

Source

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.request;

/*
 * 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 Mahe
 */
public class delete_tcp {

    public static void main(String ar[]) throws IOException {
        ServerSocket ss = new ServerSocket(9999);

        Socket s = ss.accept();

        DataInputStream in = new DataInputStream(s.getInputStream());
        DataOutputStream out = new DataOutputStream(s.getOutputStream());

        String id = in.readUTF();

        ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");

        EmployeeJDBCTemplate employeeJDBCTemplate = (EmployeeJDBCTemplate) context.getBean("employeeJDBCTemplate");

        System.out.println("Deleting Records...");

        employeeJDBCTemplate.delete(Integer.parseInt(id));

        out.writeUTF("Success");

        s.close();

    }

}