Skip to content

Instantly share code, notes, and snippets.

@kimhu
kimhu / TestN1
Last active August 29, 2015 14:05
implement the sum to the combination of N, the first class has a bug, for example, 6: can not get 2+2+2; the second class works fine.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package testsnmp4j;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@kimhu
kimhu / MultiThreadedTrapReceiver
Created August 7, 2014 08:05
This class can catch the AUTH_PRIV v3 trap, also can catch the snmp v1, v2 and v3 normal trap. Contains SNMP4j v1 and v3 trap sender example.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package testsnmp4j;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Vector;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package testfile;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
@kimhu
kimhu / MuiltiplyServerFinal.java
Last active August 29, 2015 14:02
The Java socket server, the server can accept many http request and client request; when accept http reques, send back http response; when accept client request, the server can reply the client after client input many lines.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package testfile;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package testfile;
import com.sun.corba.se.spi.orbutil.threadpool.NoSuchWorkQueueException;
import com.sun.corba.se.spi.orbutil.threadpool.ThreadPool;
import com.sun.corba.se.spi.orbutil.threadpool.WorkQueue;
import java.io.BufferedReader;